【MySQL】mysql啟動報錯./mysqld_safe: my_print_defaults: not found

神諭丶發表於2016-02-25
【問題描述】:
在安裝老版本的mysql並啟動時發現的錯誤:(mysql5.0)

  1. $ cd /data/mysql/bin
  2. $ ./mysqld_safe &

報錯資訊:
  1. root@10:/data/mysql/bin# ./mysqld_safe &
  2. [1] 4301
  3. root@10:/data/mysql/bin# ./mysqld_safe: 1: ./mysqld_safe: my_print_defaults: not found
  4. ./mysqld_safe: 1: ./mysqld_safe: my_print_defaults: not found
  5. The file /usr/local/mysql/bin/mysqld doesn't exist or is not executable
  6. Please do a cd to the mysql installation directory and restart
  7. this script from there as follows:
  8. ./bin/mysqld_safe.
  9. See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more
  10. information

在錯誤日誌裡也沒有被記錄,並且在確認了配置檔案無誤之後仍然報這個錯。


google了一下,發現原來是一個bug,官方早在08年就已經承認並記錄。
在mysql 5.0/5.1/5.5版本都有可能出現,在12年10月修正,並且在mysql5.5.19以後的版本中將不再出現。


可參考:http://bugs.mysql.com/bug.php?id=34981



【解決方案】:
往下翻評論,發現一個簡單易用的解決方法:

[3 Mar 2008 21:17] Omer Barnir
workaround: cd to 'basedir' and run ./bin/mysqld_safe to avoid the issue

意思是進入basedir目錄,找./bin/mysqld_safe並啟動就可以了。


此處是返回上級目錄:
  1. root@10:/data/mysql/bin# cd ..
  2. root@10:/data/mysql# ./bin/mysqld_safe &
  3. [1] 4391
  4. root@10:/data/mysql# nohup: ignoring input and redirecting stderr to stdout
  5. Starting mysqld daemon with databases from /data/mysql-data
  6. root@10:/data/mysql#
  7. root@10:/data/mysql# ps -ef|grep mysql
  8. root 4391 4185 0 10:23 pts/0 00:00:00 /bin/sh ./bin/mysqld_safe
  9. root 4422 4391 0 10:23 pts/0 00:00:00 /data/mysql/bin/mysqld --basedir=/data/mysql --datadir=/data/mysql-data --user=root --pid-file=/data/mysql-data/mysqld.pid --skip-external-locking --socket=/tmp/mysql.sock
  10. root 4435 4185 0 10:23 pts/0 00:00:00 grep mysql
  11. …………………………

啟動成功。


作者微信公眾號(持續更新)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29773961/viewspace-1994220/,如需轉載,請註明出處,否則將追究法律責任。

相關文章