Asterix wrote:
>
> Hi,
> I am writing a program that use JDBC to access mysql database.
> However, when I run the program I have this following error :
>
> General error: Access denied for user: '@tools1' to database 'HONGKONG'
> java.sql.SQLException: General error: Access denied for user: '@tools1' to
> database 'HONGKONG'
> at org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java)
> at org.gjt.mm.mysql.MysqlIO.sqlQuery(MysqlIO.java)
> at org.gjt.mm.mysql.Connection.execSQL(Connection.java)
> at org.gjt.mm.mysql.Statement.executeQuery(Statement.java)
> at testc.StockSlave.readRecord(StockSlave.java:157)
> at testc.StockSlave.doJob(StockSlave.java:105)
> at testc.StockSlave$1.onArrival(StockSlave.java:60)
>
> I think I have a privilege problem.
> I did flush the privilege in mysql:
>
> % mysql -uroot mysql
> mysql> flush privileges;
> % mysqladmin -uroot reload
>
> I also tried:
>
> % mysql -uroot mysql
> mysql> insert into user values ('tools1','%', '', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
> 'Y', 'Y', 'Y', 'Y');
> ERROR 1136: Column count doesn't match value count at row 1
>
> Does anybody can help me solve this problem?
> How can I allow any user from specific host to access mysql w/o submitting
> their username and password?
>
> Thank you very much.
> Regards,
>
> AJI
Hi AJI
First: I think you didn't give an user name to the driver.
You should provide your Java source code with the getConnection(...) thing.
With this we can help you.
Second: Don't give '%' for column mysql.user.User use '' (= empty string) instead.
Third: The error message indicates, that you are not using a current 3.22.xx mysql
database. Please give us the version you use.
Tschau
Christian