I am struggling to connect MySQL database with my application, I am having the following set up

  1. 3 Applications running in cluster mode and trying to connect with same DB.
  2. MySQL database running on cluster mode ( Active / Passive)

I am able to connect to MySQL from the database server itself but when I am trying to connect with DB server from my application, I am getting Access denied.

Here are few additional details

| UserAccount                    |
| 'myuser'@'%'           |       |
| 'root'@''             |
| 'root'@'::1'                   |
|                                |
| 'myuser'@'localhost'   |       |
| 'root'@'localhost'             |

MySQl service is up and running to listening to a specific IP

netstat -nap | grep mysql

tcp        0      0 serverIP:3306 *                  LISTEN      723/mysqld 
unix  2      [ ACC ]     STREAM     LISTENING     603869 723/mysqld          /mysql/mysql.sock 

For me things are looking good, even telnet to server IP with port 3306 shows me success.

but when I am trying to connect with MySQL from my application or from my local terminal , it is giving me exception

> mysql -u myuser -p db -h remoteIP --skip-secure-auth 
ERROR 1045 (28000): Access denied for user 'myuser'@'remoteIP' (using password: YES)

Can anyone help me to understand as where the things are incorrect,

  • Did you run a FLUSH PRIVILEGES after adding the 'myuser'@'%' grant? – Philᵀᴹ Nov 9 '15 at 8:07
  • it seems some password related issue..Can you set password to some simple one and then try.. – Nawaz Sohail Nov 9 '15 at 11:59

Try putting the host information as the first item in your connection string

mysql -hremoteIP -umyuser -p db

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.