I am trying to deploy my application to another server, and while the JDBC connection worked in my machine, I couldn't get it to work with this mysql server.
Some information about the mysql server:
select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
mysql> show variables where Variable_name="port";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
There is no password to login into the mysql with user localhost (mysql -u root will be enough to login)
I used the following statement to connect to the database
DriverManager.getConnection(
"jdbc:mysql://localhost:3306/database_name", "root", ""));
But, It throws the following error
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
Any suggestions? Thanks.