mysql

新裝的mysql數據庫設置密碼時報錯:

#mysqladmin -uroot -p password "newpassword"

Enter password:

mysqladmin:connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password:YES)'

解決方法:

# /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

# /etc/init.d/mysql restart

# mysql -uroot -p

Enter password: <輸入新設的密碼newpassword>

方法:

mysql> insert into mysql.user (Host,User,Password) VALUES('%','system',PASSWORD('manager'));

mysql> flush privileges;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章