mysql remote connection issues ? How to connect using php?
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 usi开发者_StackOverflowng 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.
Did you grant the permissions of the user with the hostname?
GRANT ALL ON mydb.* TO 'someuser'@'somehost';
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
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.
Please read the The MySQL Access Privilege System chapter in the MySQL documentation:
Your identity is based on two pieces of information: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.
* 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.
精彩评论