Tomcat启动/Navicat连接时报错:Access denied for user ‘root’@’localhost’ (using password: NO)

2021年09月21日 12:12
274 阅读
0 评论
0

前篇文章说到在解决上一个问题后启动tomcat后会提示错误:Access denied for user ‘root’@’localhost’ (using password: NO),根据错误信息能够看出来root账户已经没有了验证的权限,解决此问题方法有很多种,最简单的方式就是:将 mysql的密码更改为root(默认密码)后即可。

其他的解决方式如下:

方法一
/etc/init.d/mysqld 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/mysqld restart

mysql -uroot -p

Enter password: <输入新设的密码newpassword>

mysql>

方法二:

直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:

mysql -udebian-sys-maint -p

Enter password: <输入[client]节的密码>

mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;

mysql> FLUSH PRIVILEGES;

mysql> quit

mysql -uroot -p

Enter password: <输入新设的密码newpassword>

mysql>
← 上一篇Tomcat启动报错:Client does not support authentication protocol requested by server; consider upgrading MySQL client下一篇 →Windows安装MySQL8图解

评论

评论 (0)

发表评论

😀 😂 😅 😍 😒 😓 😔 😖 😘 😡 😭 😱 😤 😴 😷 😵 😎 👍 👎 👏 🙏 ❤️ 💔 🎉 🎂 🤕 😏 👻