MariaDB: Host '127.0.0.1' not privileged

gummipunkt asked:

My Ghost instance want to conntect to my MariaDB, but the error is:

Message: 'ER_HOST_NOT_PRIVILEGED: Host '127.0.0.1' is not allowed to connect to this MariaDB server'

Here my my.cnf:

[server]
skip-name-resolve
innodb_buffer_pool_size = 128M
innodb_buffer_pool_instances = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M
innodb_max_dirty_pages_pct = 90
query_cache_type = 1
query_cache_limit = 2M
query_cache_min_res_unit = 2k
query_cache_size = 64M
tmp_table_size= 64M
max_heap_table_size= 64M
slow-query-log = 1
slow-query-log-file = /var/log/mysql/slow.log
long_query_time = 1
bind-address = 127.0.0.1

[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

[client]
default-character-set = utf8mb4

[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
binlog_format = MIXED
innodb_large_prefix=on
innodb_file_format=barracuda
innodb_file_per_table=1

My answer:


I suspect that your problem is that you’ve set skip-name-resolve.

By default, the MySQL/MariaDB user database contains only entries that allow access from localhost. But if you skip name resolution, then MySQL doesn’t translate your connection from 127.0.0.1 to localhost, and thus can’t match your connection to any host that’s allowed to connect.

Remove skip-name-resolve and try again.

If you really want to keep this option, you’ll need to create MySQL users who can connect from ::1 (and 127.0.0.1 if you still use IPv4) while skip-name-resolve is disabled, and then re-enable it.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.