2
votes

I try to connect to the remote server(MariaDB 10) on windows 7.

The server setting in 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

The user grant privileges as below

GRANT ALL PRIVILEGES ON *.* TO 'remote'@'%' IDENTIFIED BY PASSWORD

And I had tried these command

>> 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

Got the error response immediately.

Can't find any other's situation with system error:54.

I tried the same mysql command on localhost with ip and port and it could be logined.

  1. Is it the firewall setting problem on the Switch?(It's worked fine with command nc -vz.)
  2. Is it the database setting problem?(It's work well on localhost.)
1
I found the reason at last. The database is behind the router and I found the nat port just stuck. Just change the nat port, it works again. I though it could be the machine's problem.user3330877
@user3330877 can you self-answer this. Shy of that, I'm voting to close because this sounds like a highly local issue "nat port just stuck" won't help people fix the problem on the router or create a better error message on the client.Evan Carroll

1 Answers

0
votes

I had the same problem. I read numerous posting and did not find any answer. In my case, I can connect successfully from some computers but not my laptop. The reason for this is that port 3306 get blocked by the company. I can connect to the mysql server through ssh tunneling (port 22). Either you ask your company open up the port or use ssh. Hope this can help other not wasting time to find a solution. You see the error message in milliseconds:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 54