
我的 Ghost 實例想要連接到我的 MariaDB,但錯誤是:
Message: 'ER_HOST_NOT_PRIVILEGED: Host '127.0.0.1' is not allowed to connect to this MariaDB server'
這是我的 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
答案1
我懷疑你的問題是你已經設定了skip-name-resolve
。
預設情況下,MySQL/MariaDB 使用者資料庫僅包含允許從localhost
.但是,如果您跳過名稱解析,則 MySQL 不會將您的連線從 轉換127.0.0.1
為localhost
,因此無法將您的連線與允許連線的任何主機相符。
刪除skip-name-resolve
並重試。
如果您確實想保留此選項,則需要建立可以在停用時進行連接::1
(127.0.0.1
如果您仍然使用 IPv4)的 MySQL 用戶,然後重新啟用它。skip-name-resolve