This article mainly introduces the solution to the initialization error of mysql5.7 when installing the rpm package in centos6.5. Friends in need can refer to it
1. Upload rz to the server and decompress
rz [root@mini2 upload]# tar -xvf mysql-5.7.19-1.el6.i686.rpm-bundle.tar
2. Install rpm package
rpm -ivh mysql-community-common-5.7.19-1.el6.i686.rpm rpm -ivh mysql-community-libs-5.7.19-1.el6.i686.rpm rpm -ivh mysql-community-libs-compat-5.7.19-1.el6.i686.rpm rpm -ivh mysql-community-client-5.7.19-1.el6.i686.rpm rpm -ivh mysql-community-server-5.7.19-1.el6.i686.rpm
Note: If it is not brand new Installation, but installed with rpm before, failed to install, and then uninstalled, the following situation may occur:
When executingrpm -ivh mysql-community-server-5.7.19 -1.el6.i686.rpm
, if the following output appears:
It is most likely because the data directory has not been cleared. Let's go down to manual initialization and execute the following command:
[root@mini2 upload]# mysqld --initialize --user=mysql 2017-08-29T05:22:18.750237Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-08-29T05:22:18.754943Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. 2017-08-29T05:22:18.755064Z 0 [ERROR] Aborting
I found that an error was reported. I searched Baidu with the error message and found that I needed to clear the data directory:
As seen from the official documentation, the data directory Location:
Then clear it and try again.
[root@mini2 upload]# rm -rf /var/lib/mysql/*
Next initialize:
mysqld --initialize --user=mysql
Next start mysql:
[root@mini2 upload]# service mysqld start
Starting mysqld: Clean, you should intuitively log in with the new password at the end)
[root@mini2 upload]# grep 'temporary password' /var/log/mysqld.log 2017-08-29T05:00:02.613275Z 1 [Note] A temporary password is generated for root@localhost: tzqjMvkHH3+C 2017-08-29T05:31:51.340338Z 1 [Note] A temporary password is generated for root@localhost: Adgwggdr%1e2
[root@mini2 upload]# mysql -uroot -p
5. Change the password and allow client login from other machines
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option
Summary
The above is the detailed content of Solution to the initialization error when installing mysql5.7 in centos6.5 using rpm package. For more information, please follow other related articles on the PHP Chinese website!