0

I am trying to connect remote mysql i am having typical issue.

$conn = mysql_connect('xxx.xxx.xxx.xxx', 'username', 'password') or die(mysql_error());

Let my system host name is my.host.com and remote one is remote.host.com

I tryed using both IP xxx.xxx.xxx.xxx and remote.host.com it is saying that

Access denied for user 'username'@'my.host.com' (using password: YES)

Please help me out of this problem.

Thanks in advance.

4 Answers 4

1

Did you grant the permissions of the user with the hostname?


GRANT ALL ON mydb.* TO 'someuser'@'somehost';

Sign up to request clarification or add additional context in comments.

2 Comments

i am using hostname as remote.host.com but it showing Access denied for user 'username'@'my.host.com' (using password: YES)
The user must have permissions on that specific host, did you set that up?
0

Check if the password and username you specified are correct and if the user is setup for access in the database.

If that does not solve the issue, read http://dev.mysql.com/doc/refman/5.1/en/access-denied.html

3 Comments

i am using hostname as remote.host.com but it showing Access denied for user 'username'@'my.host.com' (using password: YES)
The hostname is not your problem. Otherwise you would not get an Access Denied response from the server. Check User/Pass and GRANTs
Like it says in the other answers. Where did you get the username and the password to the database from? Who owns the database server?
0

You'll need to permit access to the required client host from within MySQL.

See the GRANT command (specifically the "Global privileges" bit) for the specifics.

5 Comments

i am using hostname as remote.host.com but it showing Access denied for user 'username'@'my.host.com' (using password: YES)
You need to permit access from 'my.host.com'. (Incidentally, I presume it isn't saying 'my.host.com', but rather the specific host you're attempting to connect from.)
how i can do that ? please help me
I am accessing the remote server using WHM xml api. Can i grant from WHM ?
This is basic setup stuff. If you have a management console of some sort, log in there. Look for database administration tools. If you have shell access to the machine, log in there. If in doubt, contact your server administrator/provider.
0

Please read the The MySQL Access Privilege System chapter in the MySQL documentation:

Your identity is based on two pieces of information:
* The client host from which you connect
* Your MySQL user name
Identity checking is performed using the three user table scope columns (Host, User, and Password). The server accepts the connection only if the Host and User columns in some user table row match the client host name and user name and the client supplies the password specified in that row.
I.e. if your php script runs "on" my.host.com and connects to some remote MySQL server there must be an entry in the server's mysql.user table for [username, my.host.com, yourpassword] or the server will deny access.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.