I am aware of this command:
GRANT ALL PRIVILEGES
ON database.*
TO 'user'@'yourremotehost'
IDENTIFIED BY 'newpassword';
But then it only allows me to grant a particular IP address to access this remote MySQL database. What if I want it so that any remote host can access this MySQL database? How do I do that? Basically I am making this database public so everyone can access it.
Use this command:
Then:
Then comment out the below line in file "/etc/mysql/mysql.conf.d/mysqld.cnf" (is required!):
Works for me! :-)
For example in my CentOS
comment out the following lines
then
For anyone who fumbled with this, here is how I got to grant the privileges, hope it helps someone
As noted
%
is a wildcard and this will allow any IP address to connect to your database. The assumption I make here is when you connect you'll have a user namedroot
(which is the default though). Feed in the root password and you are good to go. Note that I have no single quotes ('
) around the user root.If you are running EC2 instance don't forget to add the inbound rules in security group with MYSQL/Aurura.
Just create the user to some database like
GRANT ALL PRIVILEGES ON <database_name>.* TO '<username>'@'%' IDENTIFIED BY '<password>'
Then go to
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
and change the linebind-address = 127.0.0.1
tobind-address = 0.0.0.0
After that you may connect to that database from any IP.
You can disable all security by editing /etc/my.cnf: