Jump to content

remote connection problem


gnznroses

Recommended Posts

I have two webservers. One has my database and I want to connect to tht database from the other server (using a PHP script).

 

I've taken a PHP script that works perfect on the server that contains my DB and moved it to the new server, changing "localhost" to the DB server's IP (or domain - I tried both).

 

I used cPanel to add my new server's IPs to the allowed hosts. I then tried changing host to %.

 

When I try to connect and run a query - using PHP- I'm getting the error "no database selected". This is what I get from SSH (sanitized of course):

 

mysql -u MYUSERNAME -p -h 67.164.XXX.XXX

(it then asks for my password, which i enter)

mysql> use DATABASENAME;

> ERROR 1044 (42000): Access denied for user 'MYUSERNAME'@'%' to database 'DATABASENAME'

 

(or before I changed host to % and just listed the other server's IP, it would say Access denied for user 'MYUSERNAME'@'123.123.XXX.XXX')

 

If I SSH into the DB server I can select the DB no problem.

 

I checked that the mysql user has valid permissions. And well, this is where it gets odd.

The only user with ANY permissions is 'root'. The username I am using has all of their permissions as 'N'. But, I never connect to mysql via root. On the server with the DB, I always use that same username ("MYUSERNAME") and have no issues. I tried though changing Select_priv to Y and it still did not work.

 

Lastly, I checked my my.cnf file to be sure skip-networking is not there. And I did restart MySQL service after making changes.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/189116-remote-connection-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.