我一直在尝试重置 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$
为什么我的许可会被拒绝以及我该如何解决这个问题?
答案1
只需使用 sudo 即可:
sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
答案2
这个问题可能更适合http://serverfault.com。
看起来您没有为 /usr/local/mysql 文件夹设置正确的权限。请确保它存在且归用户所有mysql
(假设 mysql 是运行 mysqld 的用户)。