Foreword
I recently sorted out some steps and problems encountered in installing mysql8.0.13 under Linux CentOS7 system, and share with you!
One
Installation and error handling
Go to the https://www.mysql.com/downloads/msyql download page and select the community version
Check the linux version, select the corresponding version to download
[ root@VM_0_14_centos mysql]# tar -xvf mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz
[ root@VM_0_14_centos mysql]# cp -rv mysql-8.0.13-linux-glibc2.12-x86_64 /usr/local
[ root@VM_0_14_centos mysql]# cd /usr/local
[ root@VM_0_14_centos local]# mv mysql-8.0.13-linux-glibc2.12-x86_64 mysql
useradd -s /sbin/nologin -M mysql
/usr/local/mysql/bin/mysqld --initialize --user=mysql
A temporary password will be generated at this time
[ root@VM_0_14_centos mysql]# /usr/local/mysql/bin/mysqld --initialize --user=mysql
2019- 01- 20 T10:56:07.718326Z 0[System][MY-013169][Server]/usr/local/mysql/bin/mysqld(mysqld 8.0.13) initializing of server in progress as process 58262019-01-20T10:56:16.915217Z 5[Note][MY-010454][Server] A temporary password is generated for root@localhost: twi=Tlsi<0O!2019-01-20T10:56:20.410563Z 0[System][MY-013170][Server]/usr/local/mysql/bin/mysqld(mysqld 8.0.13) initializing of server has completed
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
vim /etc/my.cnf
[ mysqld]
basedir =/usr/local/mysql
datadir =/var/lib/mysql
socket =/var/lib/mysql/mysql.sock
character-set-server=utf8
[ client]
socket =/var/lib/mysql/mysql.sock
default-character-set=utf8
service mysqld start
Report an error
mysqld_safe Directory '/var/lib/mysql'for UNIX socket file don't exists.
One is because there is no /var/lib/mysql directory, and the other is because there is no write permission, the mysql.sock file cannot be generated.
[ root@VM_0_14_centos lib]# mkdir mysql
[ root@VM_0_14_centos lib]# chmod 777/var/lib/mysql
Run service mysqld start again and report another error
Starting MySQL. ERROR! The server quit without updating PID file(/var/lib/mysql/VM_0_14_centos.pid).
Print out the specific error message
[ root@VM_0_14_centos mysql]# cat VM_0_14_centos.err
2019- 01- 20 T11:11:45.906800Z 0[System][MY-010116][Server]/usr/local/mysql/bin/mysqld(mysqld 8.0.13) starting as process 77882019-01-20T11:11:45.910813Z 0[Warning][MY-013242][Server]--character-set-server:'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.2019-01-20T11:11:45.925456Z 1[ERROR][MY-011011][Server] Failed to find valid data directory.2019-01-20T11:11:45.925586Z 0[ERROR][MY-010020][Server] Data Dictionary initialization failed.2019-01-20T11:11:45.925600Z 0[ERROR][MY-010119][Server] Aborting
2019- 01- 20 T11:11:45.926342Z 0[System][MY-010910][Server]/usr/local/mysql/bin/mysqld: Shutdown complete(mysqld 8.0.13) MySQL Community Server - GPL.2019-01-20T11:12:00.049920Z 0[System][MY-010116][Server]/usr/local/mysql/bin/mysqld(mysqld 8.0.13) starting as process 79752019-01-20T11:12:00.052469Z 0[Warning][MY-013242][Server]--character-set-server:'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.2019-01-20T11:12:00.060600Z 1[ERROR][MY-011011][Server] Failed to find valid data directory.2019-01-20T11:12:00.060745Z 0[ERROR][MY-010020][Server] Data Dictionary initialization failed.2019-01-20T11:12:00.060759Z 0[ERROR][MY-010119][Server] Aborting
2019- 01- 20 T11:12:00.061610Z 0[System][MY-010910][Server]/usr/local/mysql/bin/mysqld: Shutdown complete(mysqld 8.0.13) MySQL Community Server - GPL.
Can't see the specific problem, so run service --status-all, there is an error message
ERROR! MySQL is not running, but lock file(/var/lock/subsys/mysql) exists
Some netizens said that it was enough to delete the file, but it was useless if I deleted it.
Then check the err file just now, the key error should be these two lines
2019- 01- 20 T11:11:45.925456Z 1[ERROR][MY-011011][Server] Failed to find valid data directory.2019-01-20T11:11:45.925586Z 0[ERROR][MY-010020][Server] Data Dictionary initialization failed.
So I searched for my.cnf. The configuration related to the data directory is datadir=/var/lib/mysql. I tried to delete this line. The result was successful, and the service mysqld start was successful!
The solution is as follows:
cd /usr/local/bin
ln -fs /usr/local/mysql/bin/mysql mysql
you must reset your password using ALTER USER statement before executing this statement.
Solution:
alter user user() identified by '123456';
Modify permissions configuration
grant all privileges on *.* to 'root'@'%' identified by '123456';
But error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by '123456' at line 1
Solution:
use mysql;
update user set host ='%' where user ='root';
flush privileges;
Then an error is reported when connecting with Navicat
Client does not support authentication protocol requested by server; consider upgrading MySQL client
Solution:
ALTER USER 'root'@'*' IDENTIFIED WITH mysql_native_password BY '123456';
Recommended Posts