How to grant remote access permissions to mysql server for user?
This grants root access with the same password from any machine in *.example.com
:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%.example.com' IDENTIFIED BY 'some_characters' WITH GRANT OPTION;FLUSH PRIVILEGES;
If name resolution is not going to work, you may also grant access by IP or subnet:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.%' IDENTIFIED BY 'some_characters' WITH GRANT OPTION;FLUSH PRIVILEGES;
Try:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Pa55w0rd' WITH GRANT OPTION;
You need to take some steps to make sure first mysql and then root user is accessible from outside:
Disable
skip-networking
inmy.cnf
(i.e:/etc/mysql/my.cnf
)Check value of
bind-address
inmy.cnf
, if it's set to127.0.0.1
, you can change it to0.0.0.0
to allow access from all IPs or whatever ip that you want to connect from.Grant remote access the root user from any ip (or specify your ip instead of
%
)GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_root_password' WITH GRANT OPTION;FLUSH PRIVILEGES;
Restart mysql service:
sudo service mysql restart