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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.