File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes mysql query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "mysql query" Watch "mysql query" New topic

mysql query

seenu vasu

Joined: Feb 03, 2006
Posts: 2
iam unable to connect to mysql database.iam getting the following
error when iam running the program.
Exception in thread "main" java.sql.SQLException: Access denied for user: 'root@
localhost' (Using password: YES)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
at com.mysql.jdbc.MysqlIO.doHandshake(
at com.mysql.jdbc.Connection.createNewIO(
at com.mysql.jdbc.Connection.<init>(
at com.mysql.jdbc.NonRegisteringDriver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at DBTest.main(
plezz help me n this regard
Maximilian Xavier Stocker
Ranch Hand

Joined: Sep 20, 2005
Posts: 381
The password supplied was incorrect or you don't have permission to login as root from "localhost". Note that to MySQL "localhost" is a hostname and is not the same as the actual name of your machine. You shouldn't be loggin in as mysql root anyway.

Create a new user. Make sure to specify which hosts the user can connect from.

Assign the appropriate DB permissions.

Flush the privileges table.
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
I agree. Here's the link:
subject: mysql query
jQuery in Action, 3rd edition