简体   繁体   中英

mysql.server restart gives error message

I get the following odd error when I try doing a restart with 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?

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:

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)

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

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

  • simple mysql reinstall

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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