Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'liugonli' (using password: YES)
时间: 2023-10-28 13:59:39 浏览: 124
这个异常"Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'liugonli' (using password: YES)"是指用户访问被拒绝的错误,原因是密码不正确。根据引用中的信息,你明确配置了正确的密码,但是问题出现在yml文件的配置上。你可以检查一下yml文件中的数据库配置是否正确。同时,根据引用中的描述,你使用了逆向工程-MyBatis Generator来生成代码,在代码中指定了一个mbg.xml文件作为配置文件。你发现问题是因为这个mbg.xml文件中的数据库密码没有正确修改。请确保你的mbg.xml文件中的数据库配置正确,并将密码修改为正确的密码,然后再次尝试运行代码。
相关问题
Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
This error message indicates that the user 'root' is being denied access to the MySQL database on the local machine. This could be due to one of several reasons:
1. Incorrect username or password: Make sure that the username and password for the 'root' user are correct and that they match the information used to set up the MySQL server.
2. Insufficient privileges: Check if the 'root' user has sufficient privileges to access the database. The user may require additional privileges to perform certain operations.
3. Firewall or network issues: Ensure that there are no network or firewall issues preventing the 'root' user from accessing the database.
To resolve this issue, try the following:
1. Verify the username and password for the 'root' user.
2. Grant additional privileges to the 'root' user if necessary.
3. Check for any network or firewall issues that may be preventing access to the database.
4. Ensure that the MySQL server is running and configured correctly.
5. If all else fails, try resetting the password for the 'root' user.
Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'hadoop01' (using password: YES)
这个错误提示是因为用户访问被拒绝,原因是密码不正确。可能是你在连接MySQL时输入的密码不正确,或者是MySQL数据库中的密码与你在yml文件中配置的密码不一致。你可以尝试重新输入密码或者修改yml文件中的密码,然后再次连接MySQL。如果问题仍然存在,你可以检查MySQL数据库中的用户权限是否正确,或者检查网络连接是否正常。
阅读全文