mysql -uroot -pmysql
輸入設置的密碼sql
居然報錯了!數據庫
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YSE)網絡
密碼留空ide
仍是錯誤!rest
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)ip
因而重改密碼!it
# /etc/init.d/mysql stoptable
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &class
mysql <-----登陸
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; <----修改密碼
mysql> FLUSH PRIVILEGES;
假如忘記了登陸mysql的root用戶的密碼
#/etc/init.d/mysqld stop
手動啓動數據庫
#mysqld_safe --skip-grant-tables --skip-networking &
#mysql //登陸
(這種狀況下,就不能使用grant來修改密碼,只能用update來修改密碼)
>update mysql.user set password=password('123456') where user='root'; //從新修改密碼
#/etc/init.d/mysqld restart //重啓數據庫
skip-grant-tables //跳過賦權表
skip-networking //跳過網絡