How to allow remote root access MariaDB 10.4 on Centos 7


By default, MariaDB not allow you access as root from anywhere but localhost. In order to allow remote root access to MariaDB, follow these steps.

Step 1: Accessing MariaDB on local

Use this command

sudo mysql -u root

Step 2: Grant access for root remotely

Use GRANT command

grant all privileges on *.* to 'root'@'YOUR_IP_ADDRESS' identified by 'YOUR_STRONG_PASSWORD';
flush privileges;

Now you can try to connect to MariaDB 10.4 under root account remotely from your terminal. If still not able to connect to then try to restart MariaDB

Step 3: Restart MariaDB (if necessary)

Use this command to RESTART MariaDB

systemctl restart mariadb

Sometimes, in some cases, you need to disable plugin for root before grant privileges (run in sql prompt after logging into MariaDB at step 1)

use mysql;
update user set plugin='' where User='root';