MySQL: Allow root remote access step by step instructions

  1. To allow remote connections to the root account in MySQL, you should execute the mysql_secure_installation command. Normally you run this command when first setting up MySQL, but it can be run again at any point if you need to reset the root account password or allow remote connections to the account.
    $ sudo mysql_secure_installation
    
  2. Follow the prompts until you reach one that asks Disallow root login remotely? and on this prompt, simply enter no.
  3. Once you finish going through the rest of the prompts, you will be able to access your MySQL server from remote systems using the root account. Of course, this is assuming that your firewall is correctly configured and your MySQL server (port 3306 by default) is already accessible over the internet.
  4. If this does not work for you, you can try editing the mysql.user entry for root directly.
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
    mysql> UPDATE mysql.user SET host='%' WHERE user='root';
    

    And then restart MySQL:

    $ sudo systemctl restart mysql

Did you find this article useful?

  • Install Next ERP

    HOW TO INSTALL ERPNEXT VERSION 14 IN UBUNTU 22.04 – A STEP BY STEP GUIDE written by Kara...
  • Create Database Traccar

    CREATE DATABASE traccar CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'traccar'@'loc...
  • SRV INT

    dockeusr sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal st...
  • How to Install Traccar

    Traccar Course Access the Traccar course here: Traccar Course. Sign up for DigitalOcean The fir...
  • Configure Static IP Address via Netplan

    Method 1 : Configure Static IP Address via Netplan Configuration File Netplan is a utility for ...