我尝试连接到 Windows 7 上的远程服务器(MariaDB 10)。
my.ini 中的服务器设置
datadir=E:/MariaDB 10/data
port=3306
sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
default_storage_engine=innodb
innodb_buffer_pool_size=2042M
innodb_log_file_size=50M
feedback=ON
character-set-server=utf8
skip-name-resolve
[client]
port=3306
用户授予权限如下
GRANT ALL PRIVILEGES ON *.* TO 'remote'@'%' IDENTIFIED BY PASSWORD
我试过这些命令
>> nc -vz ip port
found 0 associations
found 1 connections:
1: flags=82<CONNECTED,PREFERRED>
outif en0
src 192.168.31.242 port 58576
dst xxx.xxx.xx.xx port xxxx
rank info not available
TCP aux info available
Connection to xxx.xxx.xx.xx port xxx [tcp/creativepartnr] succeeded!
>>telnet xxx.xxx.xx.xx port
Trying xxx.xxx.xx.xx...
Connected to xxx.xxx.xx.xx.
Escape character is '^]'.
Connection closed by foreign host.
>>mysql -uremote -p -hxxx.xxx.xx.xx --port=xxxx
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 54
立即得到错误响应。
找不到任何其他人的系统错误情况:54。
我在 localhost 上使用 ip 和端口尝试了相同的 mysql 命令,它可以登录。
- 是交换机上的防火墙设置问题吗?(使用命令 nc -vz 可以正常工作。)
- 是数据库设置问题吗?(在本地主机上运行良好。)