Reputation: 324
I have two users set up, one is testuser@localhost and one is [email protected] for example. When I do the following command from ubuntu 20.04 prompt: mysql -u testuser -p it prompts me for a password and logs me on to testuser@localhost. If I try something like mysql -u 'testuser'@'111.111.11.111' -p it assumes it is localhost and gives an error message Access denied for user '[email protected]'@'localhost'. How do I specify and log on as a non localhost user?
I found the command, it is mysql -h 111.111.11.111 -u testuser -p. For some reason I am not able to logon with the user with the ip address specified. I keep getting a 2003 error which indicates some kind of configuration issue. Can't connect to MySQL server on ' server ' (10061) indicates that the network connection has been refused.
Let me edit this to make more sense in what I am trying to do. Eventually there will be two mysql servers, say one on ip address 111.111.11.111 and one on 111.111.11.112 for example. I want to be able from a php script running on 111.1111.11.111 be able to access data from a table on 111.111.11.112 for example. I am just now first trying to logon to the first server which is running a mysql database using the user name and ip address of the host.
Upvotes: 1
Views: 1040
Reputation: 324
I will post the answer to the original question which is to include a host parameter in the logon command as follows:
mysql -h 111.111.11.111 -u testuser -p
Upvotes: 1