CentOS /RHEL: How To Install MySQL 5.6 Using YUM command
How Do I install or upgrade to MySQL 6.5 version under linux operating system. How to install the latest version of MySQL 6.5 using Yum command? This post will guide you how to install MySQL database 5.6 on CentOS 7/CentOS 6.5 and RHEL 7/RHEL 6.5.
MySQL is the world’s most popular open source database, enabling the cost-effective delivery of reliable, high-performance and scalable Web-based and embedded database applications, including all five of the top five websites*.
CentOS /RHEL Install MySQL Database 5.6
Step1# before installing MySQL database, you need to install MySQL Yum repository to resove pacakge dependency.issue the following command:
#For CentOS 6.5 or RHEL 6.5
yum localinstall http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
#For CentOS 7 or RHEL 7
yum localinstall http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Outputs:
[root@osetc ~]# yum localinstall http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm Loaded plugins: fastestmirror, langpacks mysql-community-release-el7-5.noarc | 6.0 kB 00:00 Examining /var/tmp/yum-root-v8KvbT/mysql-community-release-el7-5.noarch.rpm: mysql-community-release-el7-5.noarch Marking /var/tmp/yum-root-v8KvbT/mysql-community-release-el7-5.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql-community-release.noarch 0:el7-5 will be installed --> Finished Dependency Resolution adobe-linux-x86_64 | 951 B 00:00 base/7/x86_64 | 3.6 kB 00:00 epel/x86_64/metalink | 5.4 kB 00:00 epel/x86_64 | 4.4 kB 00:00 epel/x86_64/updateinfo | 206 kB 00:00 epel/x86_64/primary_db | 3.7 MB 00:03 epel/x86_64/pkgtags | 1.3 MB 00:01 extras/7/x86_64 | 3.4 kB 00:00 nux-dextop/x86_64 | 2.9 kB 00:00 updates/7/x86_64 | 3.4 kB 00:00 Dependencies Resolved =========================================================== Package Arch Version Repository Size =========================================================== Installing: mysql-community-release noarch el7-5 /mysql-community-release-el7-5.noarch 4.3 k Transaction Summary =========================================================== Install 1 Package Total size: 4.3 k Installed size: 4.3 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql-community-release-el7-5.noarch 1/1 Verifying : mysql-community-release-el7-5.noarch 1/1 Installed: mysql-community-release.noarch 0:el7-5 Complete!
step2# Install MySQL DataBase 5.6
To Install MySQL Database 5.6 on centos 7/6.5 or RHEL 7/6.5 linux, issue the following yum command:
yum install mysql-community-server
Outputs:
[root@osetc ~]# yum install mysql-community-server Loaded plugins: fastestmirror, langpacks mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql56-community | 2.5 kB 00:03 (1/3): mysql56-community/x86_64/prima | 59 kB 00:02 (2/3): mysql-connectors-community/x86 | 7.0 kB 00:05 (3/3): mysql-tools-community/x86_64/p | 11 kB 00:05 Loading mirror speeds from cached hostfile * base: mirrors.btte.net * epel: ftp.sjtu.edu.cn * extras: mirrors.btte.net * nux-dextop: li.nux.ro * updates: mirrors.btte.net Resolving Dependencies --> Running transaction check ---> Package mariadb-server.x86_64 1:5.5.40-1.el7_0 will be obsoleted ---> Package mysql-community-server.x86_64 0:5.6.22-2.el7 will be obsoleting --> Processing Dependency: mysql-community-common(x86-64) = 5.6.22-2.el7 for package: mysql-community-server-5.6.22-2.el7.x86_64 --> Processing Dependency: mysql-community-client(x86-64) = 5.6.22-2.el7 for package: mysql-community-server-5.6.22-2.el7.x86_64 --> Running transaction check ---> Package mariadb.x86_64 1:5.5.40-1.el7_0 will be obsoleted ---> Package mysql-community-client.x86_64 0:5.6.22-2.el7 will be obsoleting --> Processing Dependency: mysql-community-libs(x86-64) = 5.6.22-2.el7 for package: mysql-community-client-5.6.22-2.el7.x86_64 ---> Package mysql-community-common.x86_64 0:5.6.22-2.el7 will be installed --> Running transaction check ---> Package mariadb-libs.x86_64 1:5.5.40-1.el7_0 will be obsoleted ---> Package mysql-community-libs.x86_64 0:5.6.22-2.el7 will be obsoleting --> Finished Dependency Resolution Dependencies Resolved =========================================================== Package Arch Version Repository Size =========================================================== Installing: mysql-community-client x86_64 5.6.22-2.el7 mysql56-community 19 M replacing mariadb.x86_64 1:5.5.40-1.el7_0 mysql-community-libs x86_64 5.6.22-2.el7 mysql56-community 2.0 M replacing mariadb-libs.x86_64 1:5.5.40-1.el7_0 mysql-community-server x86_64 5.6.22-2.el7 mysql56-community 57 M replacing mariadb-server.x86_64 1:5.5.40-1.el7_0 Installing for dependencies: mysql-community-common x86_64 5.6.22-2.el7 mysql56-community 256 k Transaction Summary =========================================================== Install 3 Packages (+1 Dependent package) Total download size: 79 M Is this ok [y/d/N]: y Downloading packages: warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.22-2.el7.x86_64.rpm: V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Public key for mysql-community-common-5.6.22-2.el7.x86_64.rpm is not installed (1/4): mysql-community-common-5.6.22- | 256 kB 00:59 (2/4): mysql-community-libs-5.6.22-2. | 2.0 MB 07:31
Step3# running the following command to start MySQL service
#For CentOS 7 or RHEL 7
systemctl start mysql.service
#For CentOS 6.5 or RHEL 6.5
service start mysqld
Step4# Enable MySQL service while system starts up by runnging the following command:
#For CentOS 7 or RHEL 7
systemctl enable mysql.service
#For CentOS 6.5 or RHEL 6.5
chkconfig mysqld on
Step5# start to run mysql secure installation To secure MySQL server, type the following command:
/usr/bin/mysql_secure_installation
Outputs:
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:=====>"enter new password" Re-enter new password:=====>"enter new password again" 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... ... Success! - 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! Cleaning up... All done! If you\'ve completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
Step6# Log on MySQL server with root password created in above secure installation, type:
mysql -u root -p
Outputs:
[root@osetc Desktop]# mysql -u root -p Enter password: Welcome to the MySQL Commands end with ; or \g. Your MySQL connection id is 13 Server version: 5.5.40-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]> Welcome to the MySQLmonitor. Commands end with ; or \g. Your MySQL connection idis 2 Server version:5.6.22-log MySQL Community Server (GPL) Copyright (c) 2000, 2014,Oracle and/or its affiliates. All rights reserved. Oracle is a registeredtrademark of Oracle Corporation and/or its affiliates. Other names may betrademarks of their respective owners. Type 'help;' or '\h' forhelp. Type '\c' to clear the current input statement. mysql>
done….