Java JDBC Access denied for user [closed]

I am trying make a connection to MySQL from my java application and it keeps on saying :

java.sql.SQLException: Access denied for user 'vincent'@'x.x.x.x' (using password: YES)

I have checked in phpmyadmin that vincent can conect from any host and I also have a python script who can connect with the same username/password without any problem

What is the problem ?

Thank you very much

Regards.


Solution 1:

Try granting all privileges to your user from any machine in mysql:

 grant all on db_name.* to ‘vincent’@'%';

where db_name is your database name ...

Solution 2:

Here's how I'd GRANT permissions:

create database foobar;
create user foobar identified by 'foobar';
grant all on foobar.* to 'foobar'@'%' identified by 'foobar';
grant all on foobar.* to 'foobar'@'localhost' identified by 'foobar';

You need the user's host machine as well.