I found similar questions but none of them helped me with a Windows machine. I originally posted this on stack overflow but it was suggested that I ask here.

I was able to connect to MySQL through my local machine. However, I have placed MySQL on a remote machine and when I try to connect to it from the local, I get the following error:

Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Im using SQL workbench to connect. I use the remote machine's actual name for the hostname and using port 139. I have MySQL started up as a service on the remote machine as well. When googling the error I get lots of jazz about editing a file in /etc/hosts.allow and my.cnf and whatnot. However, these locations were specified for Linux machines. I have a Windows 7 machine for both my local and the remote machine and therefore do not have these locations.

Any help with connecting to MySQL would be greatly appreciated.

  • Port 139? That's the NetBIOS port. MySQL runs on port 3306 by default.
    – user143703
    Jul 30 '14 at 19:06
  • For whatever reason, when checking netstat -na it shows it is listening on port 139, not 3306. I tried 3306 and the connection fails immediately. Jul 30 '14 at 19:35
  • What is your MySQL configuration? Jul 30 '14 at 19:58
  • With the initial setup config wizard I did the following: Selected Detailed configuration, Developer Machine, Multifunctional database, decision support (up to 20 connections), Enabled TCP/IP and Stricts Mode (I did make the port number 3306), and a standard character set Jul 30 '14 at 20:29
  • I would assume that you are facing the permission issue. Double-check the permissions and accounts.
    – Net Runner
    Jul 16 '17 at 7:54

Figured it out. 'root' was pointing to the root of the local machine and the root user on the remote machine was pointing to itself. So I had it connect to an admin user and it connected fine with no errors. Thanks for for the responses and help guys.



Note to self: When setting up SSH, you MUST set the following option in /etc/ssh/sshd_config:

AllowTcpForwarding yes

If you don't, then your packets will be silently dropped at the server. This results in the above error message.


My use case: I was trying to access MariaDB v10 on the Synology NAS using MySQL Workbench.

Summary of the resolution:

I found this to be a simple access grant issue to the user.

Note: Please substitute the users as necessary

Step 1: Login to MySQL

mysql -u root -p

Step 2: GRANT Remote Access


Note: My MariaDB server had multiple IPs, they all had prefix 192.168.1.* and that's why above. If your's a single IP feel free to use that in place of this. ie: @''

Step 3: Apply Changes


Give it a quick check

SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';

This step is essential. In my case, I went around changing firewalls, when the real case was this. Even in the MariaDB documentation below didn't mention this.


  1. https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/
  2. https://kb.synology.com/en-me/DSM/tutorial/Can_MariaDB_settings_be_customized_on_Synology_NAS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.