问题的根源是使用root用户安装的mysql,使用默认启动./mysqld restart会报如下错误;

mysql安装目录为:/usr/local/mysql/

[root@SHB-L0120796 bin]# ./mysqld restart
2020-03-06T09:02:19.361027Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-03-06T09:02:19.361168Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2020-03-06T09:02:19.361213Z 0 [Note] ./mysqld (mysqld 5.7.27) starting as process 29670 ...
2020-03-06T09:02:19.364761Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2020-03-06T09:02:19.364806Z 0 [ERROR] Aborting

2020-03-06T09:02:19.364835Z 0 [Note] Binlog end
2020-03-06T09:02:19.367170Z 0 [Note] ./mysqld: Shutdown complete

 

 

暂时的解决办法:

在安装目录下/usr/local/mysql/bin使用root用户启动:./mysqld --user=root start  

./mysqld --user=root start

 

或者试试在安装目录下/usr/local/mysql/bin下面执行如下命令:

service mysqld start

 

最好的解决办法:在不修改my.cnf文件的情况下,执行如下命令行

./mysqld --skip-grant-tables --skip-networking --user=root &

 

Logo

更多推荐