centos7 version using yum install mysql5.6

1. Check if MySQL is installed.

rpm -qa | grep mysql

Return null value, then it shows not installed MySQL.
Note: In the new version of CentOS7, the default database has been updated to Mariadb, rather than MySQL, so just execute the command yum install mysql database update Mariadb, and does not install MySQL.
2, view the database version Mariadb installed.

rpm -qa|grep -i mariadb

3, uninstall Mariadb database installed.

rpm -qa|grep mariadb|xargs rpm -e --nodeps

4. Check Mariadb installed version of the database to confirm they are uninstalled.

rpm -qa|grep -i mariadb

5, download the installation package to start the installation mysql5.6

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

6, mounting mysql-community-release-el7-5.noarch.rpm package

rpm -ivh mysql-community-release-el7-5.noarch.rpm

7, install mysql.

yum install mysql-server

8, start mysql service.

systemctl start mysqld.service # start mysql
systemctl mysqld.service restart # restart mysql
systemctl STOP mysqld.service # stop mysql
systemctl enable mysqld.service mysql # Set boot

9, set a password.
mysql5.6 After the installation is complete, it's the root password is empty by default, we need timely and log in as root mysql's (first directly enter, no password), and change the password.

-uroot-#mysql
MySQL> MySQL use;
MySQL> Update User password = PASSWORD SET ( "Enter Here the root password") = the User WHERE 'root';
MySQL> the flush privileges;

10, execute the following command to add the ability to remotely log in as root.

mysql> GRANT ALL PRIVILEGES ON . TO root@"%" IDENTIFIED BY "123456";

Guess you like

Origin blog.51cto.com/12226796/2478890