I'm trying to grant privileges to my "sail" mysql user, but when I log in as root it is logging me in as sail instead.
I should note that I can connect to mysql fine in PHPStorms db browser (even as root).
Here are the steps that leads to this problem
Inside the project directory on my host machine, I type the following:
sail mysql -u root -p
This command successfully logs me in, but whenever I try to run any commands I get an error, for example:
GRANT ALL PRIVILEGES ON *.* TO 'sail'@'%';
returns the following error:
ERROR 1045 (28000): Access denied for user 'sail'@'%' (using password: YES)
and if I run:
SELECT CURRENT_USER();
I get the following response:
+----------------+
| CURRENT_USER() |
+----------------+
| sail@% |
+----------------+
1 row in set (0.00 sec)
I've also tried using
sail root-shell
to then try and login to mysql inside there, but I get the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Anyone have any ideas of anything else I can try?
Sail v1.30.2
sail shell
In Docker container
mysql -h mysql -u root -ppassword
If this doesn't work, recreate the Docker volume.