在mysql啟動時$ mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)在mysql已經(jīng)關(guān)閉時返回錯誤代碼ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)網(wǎng)上很多教程都是# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables -- skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit但是mac根本沒有/etc/init.d目錄,求解
2 回答

守著星空守著你
TA貢獻(xiàn)1799條經(jīng)驗 獲得超8個贊
Mac 下忘記 MySQL root 密碼,可以這樣找回
# 不需要跑到 /etc/init.d 目錄下,可以直接運(yùn)行 mysqld_safe 命令 $ mysqld_safe --skip-grant-tables& $ mysql -u root mysql mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root'; mysql> FLUSH PRIVILEGES;
希望有所幫助~ :)
添加回答
舉報
0/150
提交
取消