0

I'm using Hibernate with JPA and MySQL.

I got accessing denied.

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

I know the username/password are ok. The problem is that is that the driver is appending @'hostname' at the end. How can I prevent that?

But the grant is only for username, and the machine are different, so I can't grant for every hostname. (I don't care if it's secure or not, it's a dev server).

I created the database that way:

create database mydbname character_set utf8 collate utf8_general_ci;
GRANT ALL ON mydbname.* TO username IDENTIFIED BY 'password';

1 Answer 1

2

You need grant to all machines that must access to MySQL.

If you have to many machines and you don't want grant every one you can do:

GRANT ALL ON mydbname.* TO username@'%' IDENTIFIED BY 'password';

or

GRANT ALL ON mydbname.* TO username@'192.168.1.%' IDENTIFIED BY 'password';

I you don't do this the clients won't be able to connect to your database

For more info: http://dev.mysql.com/doc/refman/5.1/en/grant.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.