I am trying to connect to mariadb running different container.Getting below error
$ mysql -u root -h test-mysql –port 3306
ERROR 1130 (HY000): Host 'test_1_73f6dacd1d23.test_bluenet' is not allowed to connect to this MariaDB server
Mariadb Server:
I tried the following
MariaDB [(none)]> SELECT host, user FROM mysql.user;
+--------------+------+
| host | user |
+--------------+------+
| 00a7a6a8d0af | |
| 00a7a6a8d0af | root |
| 127.0.0.1 | root |
| ::1 | root |
| localhost | |
| localhost | root |
+--------------+------+
6 rows in set (0.001 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON . TO 'root'@'%';
ERROR 1133 (28000): Can't find any matching row in the user table
Best Answer
The
GRANT
statement doesn't work because the user@host combinationroot@'%'
doesn't exist (yet). You can create it and then re-run theGRANT
:The
WITH GRANT OPTION
part gives the user the power toGRANT
privileges to other users.Note that in order to be able to connect from the other container, you may also have to remove or comment out any restrictions in your configuration (i.e. files like
/etc/my.cnf
,/etc/my.cnf.d/server.cnf
,/etc/mysql/*.cnf
) such as anybind-address
settings:Comment out with a '#':
... and then restart MariaDB.