Java JDBC Can't Connect to MySQL: Access Denied
When attempting to establish a connection to MySQL via a Java application, users may encounter the following error:
java.sql.SQLException: Access denied for user 'vincent'@'x.x.x.x' (using password: YES)
This error indicates that the specified user, 'vincent', is unable to connect to the database. Despite granting the same user connection privileges from all hosts in phpMyAdmin and successful connections using a Python script, the issue persists in Java.
Solution:
To resolve this issue, consider granting 'vincent' all privileges from any machine in MySQL by issuing the following command:
GRANT ALL PRIVILEGES ON db_name.* TO 'vincent'@'%';
Replace 'db_name' with the actual database name you wish to grant access to.
The above is the detailed content of Why Does My Java JDBC Application Get \'Access Denied\' Connecting to MySQL Despite Successful Connections from Other Languages?. For more information, please follow other related articles on the PHP Chinese website!