MySQL Connection Errors
This article describes what to do if your code attempts but fails to connect to the X10 MySQL server. Usually, this means you get an error such as "SQLSTATE  Access denied for user 'user_name'@'int.host.x10hosting.com' (using password: YES)". Basically, the solution amounts to checking the MySQL information.
MySQL authentication is based on three pieces of information which need to match what's on the server, so an "access denied" error has four potential causes:
- Wrong username.
- Wrong password.
- The client computer isn't allowed.
- Wrong server.
When you create a user using cPanel, your cPanel name and an underscore are prepended to it to create the database username. For example, if your cPanel name is "foo" and you create the user "bar", the actual database username is "foo_bar". If you leave out the prefix, the connection will fail.
Double check that your code uses the correct password for the user. If it doesn't give a password when connecting, the connection will fail. If you see "(using password: NO)" in the error message, this is the cause.
You can change the password for an existing user by following the steps to create a user but give the name (sans prefix) of an existing user. Try temporarily changing the password to something that only uses digits (except 0 and 1) and lower case letters (except l). Make sure you change it to something more complex afterwards.
As per the MySQL information, the host should be "localhost". Note that you don't need to specify the port.
 Client computer
MySQL accounts are identified by the database username and the hostname of the client computer combined. If there's no entry for both together, the connection will fail. Normally, your X10 host should have been given access to the MySQL server when your account was created or moved, but sometimes this needs to be configured manually, which you can do from within cPanel:
- Note the server name in the error message. In the example error at of the top of this article it's "int.host.x10hosting.com".
- Sign into cPanel.
- Note your server name in the "Stats" panel on the left.
- In the "Databases" panel, click "Remote MySQL"
- Make sure you see something like the following entries. Italics indicate a value that you may need to customize. If any are missing, add them.
- 10.33.248.% (internal IP block for int.vital.x10hosting.com)
- 10.33.249.% (internal IP block for int.host.x10hosting.com)
- 10.33.249.# (internal IP for int.host.x10hosting.com; you'll likely need something different)
- Where host is the name of your server and # it's last IP block number.
The first two entries you see may vary from the above, and the third will likely be different. You can get the correct value for the first by running a DNS query for "int.vital.x10hosting.com" to get its IP address, then substituting "%" for the last quad. Get the correct value for the second by doing the same for the host name from the error message, or by substituting your server name from step 2 for host. The correct value for the third is the same as for the second, but without substituting '%'.
Not all of the entries may be necessary, but neither should they cause problems. From my account, I also see a "184.108.40.206", but I suspect this is an old IP for one of the hosts I've been on.