简体   繁体   English

mysql.server重启给出错误信息

[英]mysql.server restart gives error message

I get the following odd error when I try doing a restart with MySQL: 当我尝试使用MySQL重新启动时,出现以下奇怪错误:

$ sudo mysql.server stop
Password:
Shutting down MySQL
.. SUCCESS! 
$ sudo mysql.server start
Starting MySQL
 SUCCESS! 
$ sudo mysql.server restart
Shutting down MySQL
.. SUCCESS! 
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/my.local.pid).

I had a look at the answer here: PID error on mysql.server start? 我在这里查看了答案: mysql.server启动时PID错误?

but I get the following errors: 但出现以下错误:

$ mysql_install_db
FATAL ERROR: Could not find ./bin/my_print_defaults

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

Any suggestions? 有什么建议么?

Couple of things you could try : 您可以尝试以下几种方法:

  • try a straight restart: 尝试直接重启:

sudo /usr/local/mysql/support-files/mysql.server restart

  • remove /etc/my.cnf (or rename it) and restart: 删除/etc/my.cnf(或重命名)并重新启动:

sudo mv /etc/my.cnf /etc/my.cnf.bak

sudo mysql.server restart

  • remove any .err files or create missing .pid mentionned in the error message (this one worked for me) 删除错误消息中提到的所有.err文件或创建缺少的.pid(此文件对我有用)

rm *.err /usr/local/mysql/data/

rm /usr/local/var/mysql/*.err

  • simple mysql reinstall 简单的mysql重新安装

Hope one of those does it for you ! 希望其中之一能为您做到!

It most likely is a permissions issue. 它很可能是权限问题。 Try solving it with this command: 尝试使用以下命令解决它:

$ sudo chown _mysql /usr/local/var/mysql/*

or 要么

$ sudo chown -R _mysql:_mysql /usr/local/var/mysql

It might also be that the mysql folder has a permissions issue: 可能是mysql文件夹存在权限问题:

$ sudo chmod -R 777 /usr/local/var/mysql/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM