1 message in com.mysql.lists.javamysql 4 doesnt match ip address to % ???| From | Sent On | Attachments |
|---|---|---|
| raf...@dcit.com | 06 Jan 2003 13:09 |
| Subject: | mysql 4 doesnt match ip address to % ???![]() |
|---|---|
| From: | raf...@dcit.com (raf...@dcit.com) |
| Date: | 01/06/2003 01:09:25 PM |
| List: | com.mysql.lists.java |
Hi all.
Does anyone know why the following code DOES NOT work on mysql 4.0.7-nt gamma and it DOES work on MySQL 3.23.whatever-nt.
Here is what you will get on MySQL 4... General error: Access denied for user: 'doc@127.0.0.1' to database 'dwarves'
I've tested on a brand new installation as well. Same problem.
Why??? Thanks.
--------- example code ------------
public static void main(String[] args) { try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); Connection c = DriverManager.getConnection("jdbc:mysql://localhost/","root",""); System.out.println("connected to database as root"); Statement stat = c.createStatement(); stat.execute("GRANT ALL PRIVILEGES ON *.* TO doc IDENTIFIED BY 'doc' WITH GRANT OPTION"); stat.execute("GRANT ALL PRIVILEGES ON *.* TO doc@localhost IDENTIFIED BY 'doc' WITH GRANT OPTION"); stat.execute("create database dwarves"); c.close();
Connection cc = DriverManager.getConnection("jdbc:mysql://localhost/","doc","doc"); System.out.println("connected to database as doc"); stat = cc.createStatement(); stat.execute("GRANT All PRIVILEGES ON dwarves.* TO dopey IDENTIFIED BY 'dopey'"); stat.execute("GRANT All PRIVILEGES ON dwarves.* TO dopey@localhost IDENTIFIED BY 'dopey'"); c.close();
} catch (Exception e) { System.out.println(e.getMessage()); } }




