Mysql

為 MySQL 問題重置 root 密碼(Mac OS X Lion)

  • July 3, 2012

我一直在嘗試重置 root 密碼,並且一直遵循以下說明: http: //www.coolestguyplanet.net/how-to-change-the-mysql-root-password/

但是,當我使用命令時:

/usr/local/mysql/bin/mysqld_safe --skip-grant-tables

我收到以下輸出:

111217 10:00:42 mysqld_safe Logging to '/usr/local/mysql/data/******-********-MacBook-Pro.local.err'.
111217 10:00:42 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/********-********-MacBook-Pro.local.err: Permission denied
/usr/local/mysql/bin/mysqld_safe: line 144: /usr/local/mysql/data/*******-**********-MacBook-Pro.local.err: Permission denied
111217 10:00:42 mysqld_safe mysqld from pid file /usr/local/mysql/data/*********-********-MacBook-Pro.local.pid ended
/usr/local/mysql/bin/mysqld_safe: line 107: /usr/local/mysql/data/*******-*********-MacBook-Pro.local.err: Permission denied
**********-*********-MacBook-Pro:~ myname$ 

為什麼我的許可會被拒絕,我該如何解決?

只需使用 sudo 即可:

sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

這個問題在http://serverfault.com上可能會更好。

看起來您沒有為 /usr/local/mysql 文件夾設置正確的權限。確保它存在並且歸mysql使用者所有(假設 mysql 是執行 mysqld 的使用者)。

引用自:https://serverfault.com/questions/342069