[root@VM_0_14_centos mysql]# /usr/local/mysql/bin/mysqld --initialize --user=mysql 2019-01-20T10:56:07.718326Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.13) initializing of server in progress as process 5826 2019-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
2019-01-20T11:11:45.906800Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.13) starting as process 7788 2019-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-20T11: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 7975 2019-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-20T11:12:00.061610Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.13) MySQL Community Server - GPL.
看不出来具体是哪里的问题,于是运行service –status-all,有报错信息
ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
有网友说删了该文件就可以,结果我删了也没用。
那就接着排查刚才的err文件,关键的错误应该是这两行
1 2
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.
cd /usr/local/bin ln -fs /usr/local/mysql/bin/mysql mysql
10.show databases报错
1
you must reset your password using ALTER USER statement before executing this statement.
解决方法:
1
alter user user() identified by '123456';
11.用ip无法远程登录mysql,只能用localhost在linux服务器登录 修改权限配置
1
grant all privileges on *.* to 'root'@'%' identified by '123456';
但是报错
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
解决方法:
1 2 3
use mysql; update user set host = '%' where user = 'root'; flush privileges;
接着用navicat连接时报错
Client does not support authentication protocol requested by server; consider upgrading MySQL client
解决方法:
1
ALTER USER 'root'@'*' IDENTIFIED WITH mysql_native_password BY '123456';