i can connect thru ssh or phpMyAdmin
but when my website or the application is trying to access to my database i get the below error (part of the error)
i googled but i could not really understand how i need to fix this. (i dont know much about linux or coding)

i am assuming it is ignoring network connections but how to fix it though?

thank you java.sql.SQLException: Access denied for user 'myuser'@'' (using password: YES)

Where is the database residing? Is it externally hosted or within your network? And is the website internal or external to your network?

client side is on one host A and server side code is on host B and the running application is in the host B, it is a gaming server on host B.
i am having that issue when i am trying to run the gaming server which is in the same host.

does that answer your question?

Thank you

Your problem is coming from the fact that MySQL requires a user be defined for every connection to the databases. It can also restrict what each user coming from specific IP addresses can access. If you look at the mysql database and the users table (you have to be the mysql root user to alter it) you will that the users are listed by the name of the host they connect from. A good example is the root user which normally has three entries:


Depending on how you connect to the server you may have different root permissions for the databases.

In your case you need to add the user myuser@ and give them access to the database they are requesting data from.

i tried that before and i did % as well to accept it from any server but it did not work

and on client side i get this error

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

$config["db_host"] = "";
$config["db_user"] = "myuser";
$config["db_pass"] = "mypassword";
$config["db_name"] = "mydatabase";

i must be doing something wrong

i will try again
thank you


DO you have a firewall installed that might be blocking that port. Try iptables -L to list the settings.

this is what i get

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

check from application machine:

1) nmap -P0 mysqlserverIP : is 3306 port opened and accessible

post the output from mysql server for following:

1) use mysql; select user,host from user;