当前位置:Gxlcms > 数据库问题 > Mysql登录出错 user root@localhost(using password:NO)

Mysql登录出错 user root@localhost(using password:NO)

时间:2021-07-01 10:21:17 帮助过:4人阅读

环境:redhat 5.7 安装了mysql 5.0
安装完mysql之后启动成功,但是使用mysql -uroot -p登录是,密码错误,确定没有设置过密码
出错提示:Access denied for user ‘root‘@‘localhost‘ (using password : No)
解决办法如下:

1.先关闭mysql服务
xiaopeng# /etc/init.d/mysqld stop
2.输入操作命令
xiaopeng# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3.连接mysql
xiaopeng# mysql -uroot mysql
mysql> update user set Password=PASSWORD(‘newpassword‘) where USER=‘root‘;
mysql> flush PRIVILEGES;
mysql> quit
4.重启mysql服务
xiaopeng# /etc/init.d/mysqld restart
xiaopeng# mysql -uroot -p
Enter password:<newpassword>

Mysql登录出错 user root@localhost(using password:NO)

标签:sql   word   环境   stop   using   init   登录出错   date   use   

人气教程排行