Answer the question
In order to leave comments, you need to log in
PHP/MySQL (VDS CentOS) - How to connect to a remote server?
Good afternoon. Faced the problem of connecting PHP scripts to a remote MySQL server.
There is a VDS with Apache + PHP + MySQL installed, there is a script that should connect to a database on a remote server.
<?php
mysql_connect("vh**.spaceweb.ru", "someuser", "pwd");
?>
PHP Warning: mysql_connect(): Access denied for user 'someuser'@'23.252.*.*' (using password: YES) in /var/www/html/test.php on line 3
# mysql --host="vh**.spaceweb.ru" --user="someuser" --password='pwd'
gives the same error
Answer the question
In order to leave comments, you need to log in
ERRORS TO READ!
> But when connected, it gives a rather strange error:
Access denied for user 'someuser'@'23.252.*.*'
What is strange, access is denied for a user of such and such from such and such an IP. If the login/pass is correct, then it is logical to assume that the problem is in the IP. This means that on the side of the server to which you want to connect, you need to allow calls from your IP.
How to do this is another question, I'll give you a tip - dev.mysql.com/doc/refman/5.0/en/server-options.htm...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question