Could not connect Mysql database

A

Anonymous

Guest
a few things:
1) mysql_ functions are deprecated because they are slow and insecure. You should be using PDO or mysqli_ functions at the very least.

2) redacting the ip address and username in the code is less effective when you leave it in the error message :D

3) the error message you're getting lets you know that your attempt was explicitly denied by the server, that tells you that it's not a communication issue because you're receiving the response.

Most likely your user is not setup and given permissions in the database. if you have mysql console access, you can give permissions by going into console and typing the following commands:

use mysql;
GRANT ALL privileges on database_name to to username identified by password('password');

if you don't have console access, you're probably going to have a setting in cpanel for mysql databases and database users. in that interface you have to create a user, and then explicitly link them to a database and select permissions. I'm sure there are other interfaces also, so let me know if you're still having issues (and remove your info from the quoted error message)
 
Back
Top