Access denied for user 'mysql'@'localhost' (using password: YES) # /etc/int.d/mysql stop <首先要停止你之前的启动的mysql.如果停止的时候.也出现1045的错误的话那只有kill掉mysql的pid> # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # mysql -u root mysql> use mysql mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; mysql> FLUSH PRIVILEGES; mysql> quit
# /etc/init.d/mysql start # mysql -uroot -p Enter password: <输入新设的密码newpassword>