Minggu, 14 Oktober 2018

How to install mysql 5.6 community edition from official repo centos 6

  Tidak ada komentar
Download mysql repo package from mysql official website
[root@maswachid ~]# wget https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
--2018-10-14 14:51:21--  https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
Connecting to 192.168.71.17:9898... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm [following]
--2018-10-14 14:51:23--  https://repo.mysql.com//mysql80-community-release-el6-1.noarch.rpm
Connecting to 192.168.71.17:9898... connected.
Proxy request sent, awaiting response... 200 OK
Length: 25800 (25K) [application/x-redhat-package-manager]
Saving to: “mysql80-community-release-el6-1.noarch.rpm”

100%[============================================================================================>] 25,800      --.-K/s   in 0.02s

2018-10-14 14:51:24 (1.23 MB/s) - “mysql80-community-release-el6-1.noarch.rpm” saved [25800/25800]

[root@maswachid ~]#

Check the mysql repo package and install it
[root@maswachid ~]# ls
anaconda-ks.cfg       apr-util-1.6.1.tar.gz             index.html          mysql80-community-release-el6-1.noarch.rpm
apache-2.4.36.tar.gz  epel-release-latest-6.noarch.rpm  install.log         remi-release-6.rpm
apr-1.6.5.tar.gz      httpd-2.4.36                      install.log.syslog
[root@maswachid ~]#
[root@maswachid ~]# rpm -ivh mysql80-community-release-el6-1.noarch.rpm
warning: mysql80-community-release-el6-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql80-community-relea########################################### [100%]
[root@maswachid ~]#

Open mysql repo and disable mysql 8.0 version repo
[root@cloud ~]# cd /etc/yum.repos.d/
[root@cloud yum.repos.d]# ls
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo     mysql-community-source.repo
CentOS-Debuginfo.repo  CentOS-Media.repo      mysql-community.repo
[root@cloud yum.repos.d]#
[root@cloud yum.repos.d]# vi mysql-community.repo
[root@cloud yum.repos.d]#
Find the following text, and then change enable=1 to enable=0
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/
enabled=0   (change from 1 to 0)
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Install mysql by enable specific version 
[root@maswachid ~]# yum --enablerepo=mysql56-community install mysql-community-server
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                  |  65 kB     00:00
 * base: centos.biz.net.id
 * epel: del-repos.extreme-ix.org
 * extras: centos.biz.net.id
 * remi-safe: fr2.rpmfind.net
 * updates: centos.biz.net.id
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.41-2.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.41-2.el6 for package: mysql-community-server-5.6.41-2.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.41-2.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.6.41-2.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.41-2.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.6.41-2.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.6.41-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                                Arch                   Version                        Repository                         Size
======================================================================================================================================
Installing:
 mysql-community-server                 x86_64                 5.6.41-2.el6                   mysql56-community                  55 M
Installing for dependencies:
 mysql-community-client                 x86_64                 5.6.41-2.el6                   mysql56-community                  18 M
 mysql-community-common                 x86_64                 5.6.41-2.el6                   mysql56-community                 308 k
 mysql-community-libs                   x86_64                 5.6.41-2.el6                   mysql56-community                 1.9 M

Transaction Summary
======================================================================================================================================
Install       4 Package(s)

Total download size: 75 M
Installed size: 336 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): mysql-community-client-5.6.41-2.el6.x86_64.rpm                                                          |  18 MB     00:16
(2/4): mysql-community-common-5.6.41-2.el6.x86_64.rpm                                                          | 308 kB     00:00
(3/4): mysql-community-libs-5.6.41-2.el6.x86_64.rpm                                                            | 1.9 MB     00:00
(4/4): mysql-community-server-5.6.41-2.el6.x86_64.rpm                                                          |  55 MB     00:03
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 3.1 MB/s |  75 MB     00:24
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql-community-common-5.6.41-2.el6.x86_64                                                                         1/4
  Installing : mysql-community-libs-5.6.41-2.el6.x86_64                                                                           2/4
  Installing : mysql-community-client-5.6.41-2.el6.x86_64                                                                         3/4
  Installing : mysql-community-server-5.6.41-2.el6.x86_64                                                                         4/4
  Verifying  : mysql-community-server-5.6.41-2.el6.x86_64                                                                         1/4
  Verifying  : mysql-community-client-5.6.41-2.el6.x86_64                                                                         2/4
  Verifying  : mysql-community-libs-5.6.41-2.el6.x86_64                                                                           3/4
  Verifying  : mysql-community-common-5.6.41-2.el6.x86_64                                                                         4/4

Installed:
  mysql-community-server.x86_64 0:5.6.41-2.el6

Dependency Installed:
  mysql-community-client.x86_64 0:5.6.41-2.el6                      mysql-community-common.x86_64 0:5.6.41-2.el6
  mysql-community-libs.x86_64 0:5.6.41-2.el6

Complete!
[root@maswachid ~]#
Check mysql version
[root@maswachid ~]# mysql -V
mysql  Ver 14.14 Distrib 5.6.41, for Linux (x86_64) using  EditLine wrapper
[root@sipencatar-cloud ~]#
Start mysql service
[root@maswachid ~]# service mysqld start
Initializing MySQL database:  2018-10-14 16:19:17 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-10-14 16:19:17 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-10-14 16:19:17 0 [Note] /usr/sbin/mysqld (mysqld 5.6.41) starting as process 58486 ...
2018-10-14 16:19:17 58486 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-10-14 16:19:17 58486 [Note] InnoDB: The InnoDB memory heap is disabled
2018-10-14 16:19:17 58486 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-10-14 16:19:17 58486 [Note] InnoDB: Memory barrier is not used
2018-10-14 16:19:17 58486 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-10-14 16:19:17 58486 [Note] InnoDB: Using Linux native AIO
2018-10-14 16:19:17 58486 [Note] InnoDB: Using CPU crc32 instructions
2018-10-14 16:19:17 58486 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-10-14 16:19:17 58486 [Note] InnoDB: Completed initialization of buffer pool
2018-10-14 16:19:17 58486 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2018-10-14 16:19:17 58486 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2018-10-14 16:19:17 58486 [Note] InnoDB: Database physically writes the file full: wait...
2018-10-14 16:19:17 58486 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2018-10-14 16:19:17 58486 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2018-10-14 16:19:17 58486 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-10-14 16:19:17 58486 [Warning] InnoDB: New log files created, LSN=45781
2018-10-14 16:19:17 58486 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-10-14 16:19:17 58486 [Note] InnoDB: Doublewrite buffer created
2018-10-14 16:19:17 58486 [Note] InnoDB: 128 rollback segment(s) are active.
2018-10-14 16:19:17 58486 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-10-14 16:19:17 58486 [Note] InnoDB: Foreign key constraint system tables created
2018-10-14 16:19:17 58486 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-10-14 16:19:17 58486 [Note] InnoDB: Tablespace and datafile system tables created.
2018-10-14 16:19:17 58486 [Note] InnoDB: Waiting for purge to start
2018-10-14 16:19:17 58486 [Note] InnoDB: 5.6.41 started; log sequence number 0
2018-10-14 16:19:18 58486 [Note] Binlog end
2018-10-14 16:19:18 58486 [Note] InnoDB: FTS optimize thread exiting.
2018-10-14 16:19:18 58486 [Note] InnoDB: Starting shutdown...
2018-10-14 16:19:19 58486 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2018-10-14 16:19:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-10-14 16:19:19 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-10-14 16:19:19 0 [Note] /usr/sbin/mysqld (mysqld 5.6.41) starting as process 58508 ...
2018-10-14 16:19:19 58508 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-10-14 16:19:19 58508 [Note] InnoDB: The InnoDB memory heap is disabled
2018-10-14 16:19:19 58508 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-10-14 16:19:19 58508 [Note] InnoDB: Memory barrier is not used
2018-10-14 16:19:19 58508 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-10-14 16:19:19 58508 [Note] InnoDB: Using Linux native AIO
2018-10-14 16:19:19 58508 [Note] InnoDB: Using CPU crc32 instructions
2018-10-14 16:19:19 58508 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-10-14 16:19:19 58508 [Note] InnoDB: Completed initialization of buffer pool
2018-10-14 16:19:19 58508 [Note] InnoDB: Highest supported file format is Barracuda.
2018-10-14 16:19:19 58508 [Note] InnoDB: 128 rollback segment(s) are active.
2018-10-14 16:19:19 58508 [Note] InnoDB: Waiting for purge to start
2018-10-14 16:19:19 58508 [Note] InnoDB: 5.6.41 started; log sequence number 1625977
2018-10-14 16:19:19 58508 [Note] Binlog end
2018-10-14 16:19:19 58508 [Note] InnoDB: FTS optimize thread exiting.
2018-10-14 16:19:19 58508 [Note] InnoDB: Starting shutdown...
2018-10-14 16:19:21 58508 [Note] InnoDB: Shutdown completed; log sequence number 1625987




PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/bin/mysqladmin -u root password 'new-password'
  /usr/bin/mysqladmin -u root -h maswachid password 'new-password'

Alternatively you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

Note: new default config file not created.
Please make sure your config file is current

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@maswachid ~]#
Perform mysql secure installation
[root@maswachid ~]# mysql_secure_installation



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...
[root@maswachid ~]#
Restart mysql service to make sure there is no error
[root@maswachid log]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@maswachid log]#


Tidak ada komentar :

Posting Komentar