I am using the mysql
package to connect to ProxySQL that is set-up to connect to a MySQL database. From command line, the following works:
mysql -u demo1 -P6033 --database=database -p
However, this does not work.
var connection = mysql.createConnection({
"host" : "localhost",
"port": 6033,
"user": "demo1",
"password" : "password as above",
"database": "database"
})
connection.connect( (err) => { console.log(err.stack) } )
This is the error message.
Error: ER_ACCESS_DENIED_ERROR: ProxySQL Error: Access denied for user 'demo1'@'127.0.0.1' (using password: YES)
The user was created as
CREATE USER 'demo1'@'localhost' IDENTIFIED BY 'password';
I tried adding another user as 'demo'@'127.0.0.1'
and granted privileges for the same; didn't work.
How do I retain the definition above and get mysql
to return a successful connection?