MySQL allow remote root login in Ubuntu and CentOS

Spread the love

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

to

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 2.2.2.2.

Note: Please replace IP Address 2.2.2.2 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:

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. Founder of SillyCodes. I am a programmer, Presently working as a Software Engineer in Hyderabad. I love Linux and Open Source. Apart from that, I love to explore new technologies and things.

You may also like...

1 Response

  1. 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 0.0.0.0 or whatever IP you want.

Leave a Reply