0

My code is simply:

$connection = new mysqli('52.62.xx.xx', $myUsr, $myPwd, $myDB, '3306');

The strange thing is that the IP address, or remote host, is being replaced with the IP address of my server, and I get the following error:

Access denied for user 'myUsr'@'107.191.xx.xx'

Why is mysqli trying to connect to 107.191.xx.xx when I'm explicitly telling it to connect to 52.62.xx.xx

What am I missing here?

I don't think it's too relevant, but the remote host is an Amazon Aurora instance.

EDIT:

Ok, so on the HOST server I ran: GRANT ALL PRIVILEGES ON *.* TO 'myUsr'@'107.191.xx.xx' IDENTIFIED BY 'password'

Now it works :)

Emmanuel
  • 4,933
  • 5
  • 46
  • 71
  • `Access denied for user 'myUsr'@'107.191.xx.xx'` is the correct error message. Have you set up the remote host to accept connections from `107.191.xx.xx` – cmorrissey Feb 16 '16 at 21:48
  • Don't you have to use the host *name* with an RDS? From the [docs](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Connect.html) *For host or host name, specify mycluster.cluster-123456789012.us-east-1.rds.amazonaws.com* – Jay Blanchard Feb 16 '16 at 21:49
  • 2
    Possible duplicate of [Enable remote MySQL connection: ERROR 1045 (28000): Access denied for user](http://stackoverflow.com/questions/8380797/enable-remote-mysql-connection-error-1045-28000-access-denied-for-user) – cmorrissey Feb 16 '16 at 21:50
  • I've tried with both the hostname and ip. Same thing. Yes, the remote host is setup to accept connections from 107.191.xx.xx – Emmanuel Feb 16 '16 at 22:03

2 Answers2

3

This

`Access denied for user 'myUsr'@'107.191.xx.xx'`

mean that user myUsr tried connect from IP 107.191.xx.xx. This is your IP address of server with your script.

You should configure the HOST mysql server to allow myUsr to connect from this IP or from all addresses.

Emmanuel
  • 4,933
  • 5
  • 46
  • 71
newman
  • 2,689
  • 15
  • 23
0

Hi you must grant your user to connect from the your local IP remotely to mysql server, your user doesn't have the right to use remote connection to mysql you can try this command to make your user able to connect to mysql server from you local IP address GRANT ALL ON youDB.* TO youUser@'YOUR_LOCAL_IP' IDENTIFIED BY 'USER_PASSWOR';