0

my database name is :

test 

i gave :

grant all on test.* to 'me' identified by 'foolinGAround_8-' 

and when i try to connect through jdbc i am getting

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Access denied for user 'me'@'%' to database 'test/'

what is the reason and how can I solve it?

TallTed
  • 9,069
  • 2
  • 22
  • 37
muthu
  • 79
  • 2
  • 6
  • `select user,host from mysql.user where user='me'` – Drew Oct 14 '16 at 15:22
  • sorry mr Drew i am new to both sql and java i cant understand you answer please forgive me . – muthu Oct 14 '16 at 15:23
  • can you please elabrate so it will be help ful for me – muthu Oct 14 '16 at 15:24
  • 1
    Your user does not have remote access. Use `grant all on test.* to 'me'@'%' identified by 'foolinGAround_8-'` – Leon Oct 14 '16 at 15:32
  • no still i get the same sql exception Mr Leon – muthu Oct 14 '16 at 15:52
  • connect using the root/master user and run `select user,host from mysql.user where user='me'` - edit your question to show the output – Daniel Scott Oct 14 '16 at 20:57
  • Have you used `flush privileges` or restarted the MySQL server? See also http://stackoverflow.com/questions/8380797/enable-remote-mysql-connection-error-1045-28000-access-denied-for-user?rq=1 – Mark Rotteveel Oct 15 '16 at 10:39
  • i havent flush privileges but restarted my sql many times – muthu Oct 18 '16 at 16:07
  • Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection( "jdbc:mysql://localhost:3306/test/","me","foolinGAround_8-"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from emp"); – muthu Oct 18 '16 at 16:09
  • i gave the above in java and when trying to run the java code getting error – muthu Oct 18 '16 at 16:10
  • com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Access denied for user 'me'@'%' to database 'test/' – muthu Oct 18 '16 at 16:11

1 Answers1

2

try GRANT ALL PRIVILEGES ON test.* TO 'me'@'%'IDENTIFIED BY 'foolinGAround_8-' WITH GRANT OPTION;

imaginary
  • 21
  • 1