Connecting to MySQL from a remote machine - instructions don't work

Keywords: MySQL - AWS - Technical issue - Secure Connections (SSL/HTTPS)
I was following the instructions on:

and at the end, it says to run:

/opt/bitnami/mysql/bin/mysql -u root -p -e “grant all privileges on . to ‘root’@’%’ identified by ‘PASSWORD’ with grant option”;

but when I run that I get the following message:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘identified by ‘PASSWORD’ with grant option’ at line 1

This is using Bitnami Wordpress on AWS Lightsail.

The support file wasn’t automatically uploaded so I have no code.

Hi @philipt18,

Can you use this command instead?

/opt/bitnami/mysql/bin/mysql -u root -p -e "grant all privileges on *.* TO 'root'@'%';"

That should work for you and I’ll notify our documentation team to update the documentation accordingly.

Happy to help!

Was my answer helpful? Click on :heart:

Thank you. I tried your command, but got the following error:

ERROR 1410 (42000) at line 1: You are not allowed to create a user with GRANT

Sorry @philipt18,

I just checked the solution and found that the root@’%’ user is not created in the database. Can you run these commands?

/opt/bitnami/mysql/bin/mysql -u root -p -e "create user 'root'@'%' identified by 'YOUR_PASSWORD';"
/opt/bitnami/mysql/bin/mysql -u root -p -e "grant all privileges on *.* TO 'root'@'%';"
sudo /opt/bitnami/ restart mysql

Let me know if those commands work for you.

Why is it necessary to create a root user? Isn’t there a way to just modify the permissions of my current user?

Hi @philipt18,

It’s not necessary to create a new user, I just created that root user because it’s not created by default and I thought you were using it to access the database. If you already have a user created with the host “%”, you just need to run the other 2 commands

/opt/bitnami/mysql/bin/mysql -u root -p -e "grant all privileges on YOUR_DATABASE.* TO 'YOUR_USER'@'%';"
sudo /opt/bitnami/ restart mysql

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.