mysql安装完成后登入错误
时间:2014-05-14 16:36:13
收藏:0
阅读:368
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
解决:
1、先停止mysql服务,命令如下:
#/etc/init.d/mysql stop
2、重新启动服务,命令如下:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3、登入mysql并修改密码:命令和SQL如下:
# mysql -u root mysql
mysql> update user set password=PASSWORD(‘新密码‘) where user=‘root‘;
mysql> flush privileges;
mysql>commit;
mysql>quit;
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
4、查看mysql后台进程是否启动了,命令如下:
#/etc/init.d/mysql status
#mysql -uroot -p
Enter password:<输入新设置的密码>
5、查看数据信息:
mysql>show databases;
如果报告下面错误:
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
请执行下面命令:
mysql>SET PASSWORD=PASSWORD(‘新密码‘);
再执行:
mysql>show databases;
一切好了ok了!
评论(0)