172 views

Host 'localhost' is not allowed to connect to this MariaDB server

The error message can be "host gateway is not allowed" or "host localhost is not allowed" depending upon where you are trying to connect. This error is seen while trying to connect using MySQL client tool HeidiSQL Portable

Solution:
Grant required privileges to the username you are trying to connect.
Here is an example for the username admin

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;

CREATE USER 'admin'@'%' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES;

Make necessary changes to username and password

MySQL Commandline output:

MariaDB [(none)]>
MariaDB [(none)]> CREATE USER 'admin'@'localhost' IDENTIFIED BY 'PASSWORD';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
MariaDB [(none)]> CREATE USER 'admin'@'%' IDENTIFIED BY 'PASSWORD';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]>
Jan 24 by | 172 views
DevOpsRun.com is LIVE!

Articles for DevOps Geeks
MobaXterm Customization
CHMOD Explained!
Bash history powerful tips
Ubuntu bash from Windows
..