Run the RPM package to install MySQL 5.7.9 in Centos 7.
Record the installation tutorials for MySQL 5.7.9.
Environment Introduction:
Operating System: Centos 7.1
Mysql database version: mysql5.7.9
Mysql Official Website: http://www.mysql.com
1. Before installing the new mysql version, we need to uninstall the mariadb-lib that comes with the system.
[root@5201351 ~]# rpm -qa|grep mariadbmariadb-libs-5.5.41-2.el7_0.x86_64[root@5201351 ~]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64 --nodeps
2, to the mysql official website to download the latest mysql rpm collection package: mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar
3. Upload mysql-5.7.9-1.el7.x86_64.rpm-bundle.tar to the linux server and decompress the tar package.
4. to install the mysql-server service, you only need to install the following four software packages. You can run the rpm-ivh command to install the service.
Mysql-community-common-5.7.9-1.el7.x86_64.rpm
Mysql-community-libs-5.7.9-1.el7.x86_64.rpm -- (depending on common)
Mysql-community-client-5.7.9-1.el7.x86_64.rpm -- (dependent on libs)
Mysql-community-server-5.7.9-1.el7.x86_64.rpm -- (dependent on client, common)
5. The next step is to initialize the database. We can use the following commands to achieve the same effect.
[Root @ 5201351 ~] # Mysql_install_db -- datadir =/var/lib/mysql // datadir must be specified. After execution ~ /. Mysql_secret Password File [root @ 5201351 ~] # Mysqld -- initialize // This method is recommended for the new version. The execution will generate a random password in/var/log/mysqld. log
6. Change the user and group of the mysql database directory, and then start the mysql database
[Root @ 5201351 ~] # Chown mysql: mysql/var/lib/mysql-R [root @ 5201351 ~] # Systemctl start mysqld. service // start mysql Database service
7. log on to mysql according to the password in step 1 and change the password of the root user. The new mysql version cannot execute any command before changing the password after the first login.
[root@5201351 ~]# mysql -uroot -p')j#)=uRig4yJ'mysql> set password=password('www.cnblogs.com/5201351');
8. Finally, we can create users and assign permissions based on actual conditions.
mysql> create user 'root'@'192.168.100.2' identified by 'QQ5201351'; mysql> GRANT ALL PRIVILEGES ON dbname.* to 'root'@'192.168.100.2';mysql> flush privileges
Note that the Password field is no longer in the user table of the new mysql database,
Instead, the encrypted user password is stored in the authentication_string field.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.