(是的, 这个问题看起来非常相似 ,但是我明白为什么我能得到这个信息,我没有得到什么,也无法亲自find任何明显的信息,所以我就是这样做的。 )
我正在尝试在我的VPS上设置Postfix和Dovecot,决定使用MariaDB进行MySQL路由。 按照这个指南 ,这似乎很好。
尽可能用postmaptestingDBconfiguration文件,当服务器只是拒绝连接。 这是我得到的错误信息;
postmap: warning: connect to mysql server 127.0.0.1: Can't connect to MySQL server on '127.0.0.1' (111 "Connection refused") postmap: fatal: table mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf: query error: Transport endpoint is not connected
MariaDB的configuration文件设置为与127.0.0.1绑定,我为127.0.0.1打开了3306,甚至试图完全禁用防火墙而没有任何改变。
看来这个IP和端口不能怪,那么我认为这个“传输端点”一定是罪魁祸首 – 如果这不是引用IP /端口的另一种方式。
如果任何人有什么我可以尝试解决这个问题的build议,我会非常感激。
编辑:如果它有什么区别,我也使用nginx。
编辑II:“服务MySQL状态”的结果:
* /usr/bin/mysqladmin Ver 9.1 Distrib 10.1.11-MariaDB, for debian-linux-gnu on x86_64 Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Server version 10.1.11-MariaDB-1~trusty-log Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/run/mysqld/mysqld.sock Uptime: 2 hours 37 min 16 sec
我在这里find了答案,在HBruijn设置了正确的path后: https ://mariadb.com/kb/en/mariadb/configuring-mariadb-for-remote-client-access/
MariaDB具有跳过networking指令,默认情况下处于活动状态,从而停止所有TCP / IP连接。 在注释掉之后,我仍然保留绑定地址,让MariaDB只在本地连接的默认端口(3306)上侦听TCP。
在my.cnf中改变这个:
#skip-networking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1
重新启动mysql服务并testing,看看哪些端口被监听;
# netstat -tln Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State ..some records.. tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
也成功通过127.0.0.1login到MariaDB,一切正常! 好极了!
# mysql -u mailuser -h 127.0.0.1 -D mailserver -p Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 49 Server version: 10.1.11-MariaDB-1~trusty-log mariadb.org binary distribution Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mailserver]>It finally works!