Introduction to Environment >>>>>>>>>>>>>>>>>>
Operating system: Centos 7.1
MySQL database version: mysql5.7.9
MySQL official website: http://www.mysql.com
---------------------------------------------
1, before installing the new version of MySQL, we need to bring the system Mariadb-lib Uninstall
[Email protected]5201351 ~]# rpm-qa| grep mariadbmariadb-libs-5.5. 2. El7_0.x86_64[[email protected]5201351 ~]# rpm-e mariadb-libs-5.5 . 2. el7_0.x86_64--nodeps
2, to the official website of MySQL download the latest version of the Yum warehouse files, to the author when the latest Yum warehouse file: mysql57-community-release-el7-7.noarch.rpm
3. Upload the mysql57-community-release-el7-7.noarch.rpm to the Linux server and install it using the RPM command as shown in:
4. When we install the Mysql-server database service using Yum, we only need to install it, Yum will solve the required dependency problem by itself.
[[Email protected]5201351~]#Yum InstallMysql-community-server.x86_64-y//Yum installation mysql-community-server service................ Omit part of the output ......... ....... Installed:mysql-community-libs.x86_640:5.7.9-1. EL7 mysql-community-libs-compat.x86_640:5.7.9-1. el7 MySQL-community-server.x86_640:5.7.9-1. El7 Dependency installed:mysql-community-client.x86_640:5.7.9-1. EL7 mysql-community-common.x86_640:5.7.9-1. EL7REPLACED:MARIADB-libs.x86_641:5.5. A-2. El7_0complete!
5, followed by the initialization of the database, we use the following two methods are available, the effect is the same
[[email protected]5201351 ~]# mysql_install_db--datadir=/var/lib/mysql // must specify DataDir, ~/.mysql_secret password file is generated after execution -00:20: [ WARNING] mysql_install_db is deprecated. Consider switching to mysqld--initialize[[email protected]5201351 ~]# mysqld--initialize // new version of recommended this method, the executor generates a random password in/var/log/mysqld.log
6. Change the user and the group to which the MySQL database directory belongs, and then start the MySQL database
[Email protected]5201351chown mysql:mysql/var/lib/mysql-r[[email protected] 5201351 ~]# systemctl start mysqld.service // start MySQL database service
7, according to the password in the 5th step to log in to MySQL, change the root user's password, the new version of MySQL after the first login to change the password is not able to execute any command
[[email protected] ~]# MySQL-Uroot-P'G3ok; Ggjst&p'MySQL> Selectversion (); ERROR1820(HY000): You must reset your password usingALTER USERstatement before executing this statement.mysql> SetPassword for 'Root'@'localhost'=Password'www.cnblogs.com/5201351'); MySQL> Selectversion ();+-----------+|Version ()|+-----------+| 5.7.9 |+-----------+1Rowinch Set(0.00sec) MySQL>
8, finally we can also create a user according to the actual situation, and for the permission assignment
Mysql> Create User 'Root'@'192.168.100.2'Identified by 'QQ5201351'; MySQL> GRANT All Privileges ondbname.* to 'Root'@'192.168.100.2'; MySQL>FlushPrivileges
==============================================
Finally, it is important to note that there is no password field in the user table in the new MySQL database.
Instead, the encrypted user password is stored in the authentication_string field
Respect for the work of others reproduced please be sure to indicate the source: http://www.cnblogs.com/5201351/p/4912614.html
Yum installation method for MySQL 5.7.x database under Linux