mysqladmin -u root password newpass
之後想重設定如下,都只會有
$ mysqladmin -u root -p 'newpass' password Enter password: mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: NO)'
不論我怎設定都不行,查了半天,看來這問題很多人都有,這邊做個記錄好了。我的系統是Mac,所以在停止Mysql server的command會有不同
$ sudo /usr/local/mysql/support-files/mysql.server stop $ sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking & $ mysql -u root mysql mysql> UPDATE user SET Password=PASSWORD('你的密碼') where USER='root'; mysql> quit; $ sudo /usr/local/mysql/support-files/mysql.server start $ mysql -u root -p Enter password:
能進入mysql>就表示ok囉
參考網址:
MySQL Change root Password
解決 MYSQL 登入時,ERROR 1045 (28000) using password: NO 的方法
mysql Access denied for user root@localhost错误解决方法总结
沒有留言:
張貼留言