?
?? Mysql root访问异常:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
?
解决办法,重设root密码
?
? 1、先停mysql服务,service mysql stop
? 2、# cd /usr/local/mysql/bin
? 3、跳过授权访问:# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
? 4、启动mysql服务:# mysql -u root mysql
? 4、重设root用户密码:mysql>UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
? 5、刷新:mysql>FLUSH PRIVILEGES;
?
???? 启动mysql服务的时候可能不遇到以下问题:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)因为mysql默认安装的时候mysql.sock文件保存在 /tmp/目录下;
可以这样启动:mysql -u root -S /tmp/mysql.sock mysql
?