-
-
Notifications
You must be signed in to change notification settings - Fork 652
Description
Basic example:
this.connection = await MYSQL.createConnection(
'mysql://root:password@localhost:3306/test'
);
It connects fine, but then - it should login as 'root'@'localhost', right?
Instead I get Error: Access denied for user 'root'@'10.0.0.33' (using password: YES)
Started happening after PC reboot, I checked ifconfig and 10.0.0.33 just happened to be listed first:
$ ifconfig | grep inet
inet 10.0.0.33 netmask 255.255.255.0 broadcast 10.0.0.255
inet 127.0.0.1 netmask 255.0.0.0
inet 10.8.23.3 netmask 255.255.255.0 destination 10.8.23.3
So my guess is that's why it got picked up as host part of user.
Why is it a problem? Because it forces to create all users as 'user'@'%' just in case mysql2 picks wrong user host part. It may lower security in some cases and can be inconvenience when you have to change 'localhost' to '%' for all users and reapply all grants on a big DB.
I tried googling for easy solution but there's nothing. Is there any easy fix?