MySQL allow remote root login in Ubuntu and CentOS

mysql remote root login from remote users

Allowing MySQL Root Login from All IP Addresses :

Mysql remote root access is disabled by default. Now in this tutorial, we will look into how to enable remote MySQL root access. 
First of all, open the /etc/mysql/my.cnf   file using any of editor. then find the line bind-address. Then comment out that line something like below.

Change line


Now, we need to change the permission in MySQL using following command.
Please run the following command in MySQL CLI.

Note: Above command allows root access from all IP Address.

Allowing Root Access from Specific IP address:

Now we need to add our public IP address ( your desired IP Address ) to the MySQL whitelisted IP address. Please run the following command to enable the root login from IP Address

Note: Please replace IP Address with your desired IP Address.

Then run the following command to make all your changes to affect.

then restart the MySQL server.
On ubuntu:

On centos 7:


Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

3 Responses

  1. mohan says:

    Thank u very much it worked

  2. If your Using MYSQL 5.7 on Ubuntu 16.04, Then bind-address can be found in the following configuration file.

    vim /etc/mysql/mysql.conf.d/mysqld.cnf

    change the Bind-address to or whatever IP you want.

  1. […] MySQL allow remote root login in Ubuntu and CentOS … […]

Leave a Reply