You need to take some steps to make sure first mysql and then root user is accessible from outside:
Disable skip-networking
in my.cnf
(i.e: /etc/mysql/my.cnf
)
Check value of bind-address
in my.cnf
, if it's set to 127.0.0.1
, you can change it to 0.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