Home > Database > Mysql Tutorial > Why Does My Java JDBC Application Get \'Access Denied\' Connecting to MySQL Despite Successful Connections from Other Languages?

Why Does My Java JDBC Application Get \'Access Denied\' Connecting to MySQL Despite Successful Connections from Other Languages?

Patricia Arquette
Release: 2024-11-27 14:40:11
Original
650 people have browsed it

Why Does My Java JDBC Application Get

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)
Copy after login

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'@'%';
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template