Can't connect to a stand alone MySQL server from a google cloud compute VM instance












0















I have a server in my office running MySQL. I've connected to this server from laptops and PCs far and wide. However, when trying to connect into it from a Google Cloud Compute Engine VM Instance I'm getting the following error:



>>> import mysql.connector
>>> dbconfig = {'host': 'redacted', 'user': 'redacted', 'database': 'redacted', 'password': 'redacted'}
>>> cnx = mysql.connector.connect(**dbconfig)
Traceback (most recent call last):
File "/home/me/anaconda3/lib/python3.7/site-
packages/mysql/connector/connection_cext.py", line 176, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Lost connection to MySQL server at 'reading initial communication packet', system error: 104

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/__init__.py", line 172, in connect
return CMySQLConnection(*args, **kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 78, in __init__
self.connect(**kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 731, in connect
self._open_connection()
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 179, in _open_connection
sqlstate=exc.sqlstate)
mysql.connector.errors.OperationalError: 2013 (HY000): Lost connection to
MySQL server at 'reading initial communication packet', system error: 104


The VM is an Ubuntu 16.04.5 installed last month from the stock image. I tried the connection from python 3.7 console using mysql-connector-python.



Is there any firewall rule I need to add perhaps?










share|improve this question























  • Are you sure that you can connect from other systems outside your office? This is a problem on the MySQL server side (firewall, incorrect TCP binding, etc.). What address is MySQL listening on? Make sure that address can be accessed externally.

    – John Hanley
    Nov 22 '18 at 18:29











  • Yes I'm sure. I've been using this MySQL server for a long time and accessed it from the train, from another country - hotels, etc.

    – Tomer
    Nov 23 '18 at 13:29
















0















I have a server in my office running MySQL. I've connected to this server from laptops and PCs far and wide. However, when trying to connect into it from a Google Cloud Compute Engine VM Instance I'm getting the following error:



>>> import mysql.connector
>>> dbconfig = {'host': 'redacted', 'user': 'redacted', 'database': 'redacted', 'password': 'redacted'}
>>> cnx = mysql.connector.connect(**dbconfig)
Traceback (most recent call last):
File "/home/me/anaconda3/lib/python3.7/site-
packages/mysql/connector/connection_cext.py", line 176, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Lost connection to MySQL server at 'reading initial communication packet', system error: 104

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/__init__.py", line 172, in connect
return CMySQLConnection(*args, **kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 78, in __init__
self.connect(**kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 731, in connect
self._open_connection()
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 179, in _open_connection
sqlstate=exc.sqlstate)
mysql.connector.errors.OperationalError: 2013 (HY000): Lost connection to
MySQL server at 'reading initial communication packet', system error: 104


The VM is an Ubuntu 16.04.5 installed last month from the stock image. I tried the connection from python 3.7 console using mysql-connector-python.



Is there any firewall rule I need to add perhaps?










share|improve this question























  • Are you sure that you can connect from other systems outside your office? This is a problem on the MySQL server side (firewall, incorrect TCP binding, etc.). What address is MySQL listening on? Make sure that address can be accessed externally.

    – John Hanley
    Nov 22 '18 at 18:29











  • Yes I'm sure. I've been using this MySQL server for a long time and accessed it from the train, from another country - hotels, etc.

    – Tomer
    Nov 23 '18 at 13:29














0












0








0








I have a server in my office running MySQL. I've connected to this server from laptops and PCs far and wide. However, when trying to connect into it from a Google Cloud Compute Engine VM Instance I'm getting the following error:



>>> import mysql.connector
>>> dbconfig = {'host': 'redacted', 'user': 'redacted', 'database': 'redacted', 'password': 'redacted'}
>>> cnx = mysql.connector.connect(**dbconfig)
Traceback (most recent call last):
File "/home/me/anaconda3/lib/python3.7/site-
packages/mysql/connector/connection_cext.py", line 176, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Lost connection to MySQL server at 'reading initial communication packet', system error: 104

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/__init__.py", line 172, in connect
return CMySQLConnection(*args, **kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 78, in __init__
self.connect(**kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 731, in connect
self._open_connection()
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 179, in _open_connection
sqlstate=exc.sqlstate)
mysql.connector.errors.OperationalError: 2013 (HY000): Lost connection to
MySQL server at 'reading initial communication packet', system error: 104


The VM is an Ubuntu 16.04.5 installed last month from the stock image. I tried the connection from python 3.7 console using mysql-connector-python.



Is there any firewall rule I need to add perhaps?










share|improve this question














I have a server in my office running MySQL. I've connected to this server from laptops and PCs far and wide. However, when trying to connect into it from a Google Cloud Compute Engine VM Instance I'm getting the following error:



>>> import mysql.connector
>>> dbconfig = {'host': 'redacted', 'user': 'redacted', 'database': 'redacted', 'password': 'redacted'}
>>> cnx = mysql.connector.connect(**dbconfig)
Traceback (most recent call last):
File "/home/me/anaconda3/lib/python3.7/site-
packages/mysql/connector/connection_cext.py", line 176, in _open_connection
self._cmysql.connect(**cnx_kwargs)
_mysql_connector.MySQLInterfaceError: Lost connection to MySQL server at 'reading initial communication packet', system error: 104

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/__init__.py", line 172, in connect
return CMySQLConnection(*args, **kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 78, in __init__
self.connect(**kwargs)
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/abstracts.py", line 731, in connect
self._open_connection()
File "/home/me/anaconda3/lib/python3.7/site-packages/mysql/connector/connection_cext.py", line 179, in _open_connection
sqlstate=exc.sqlstate)
mysql.connector.errors.OperationalError: 2013 (HY000): Lost connection to
MySQL server at 'reading initial communication packet', system error: 104


The VM is an Ubuntu 16.04.5 installed last month from the stock image. I tried the connection from python 3.7 console using mysql-connector-python.



Is there any firewall rule I need to add perhaps?







mysql google-cloud-platform google-compute-engine






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 13:20









TomerTomer

3371310




3371310













  • Are you sure that you can connect from other systems outside your office? This is a problem on the MySQL server side (firewall, incorrect TCP binding, etc.). What address is MySQL listening on? Make sure that address can be accessed externally.

    – John Hanley
    Nov 22 '18 at 18:29











  • Yes I'm sure. I've been using this MySQL server for a long time and accessed it from the train, from another country - hotels, etc.

    – Tomer
    Nov 23 '18 at 13:29



















  • Are you sure that you can connect from other systems outside your office? This is a problem on the MySQL server side (firewall, incorrect TCP binding, etc.). What address is MySQL listening on? Make sure that address can be accessed externally.

    – John Hanley
    Nov 22 '18 at 18:29











  • Yes I'm sure. I've been using this MySQL server for a long time and accessed it from the train, from another country - hotels, etc.

    – Tomer
    Nov 23 '18 at 13:29

















Are you sure that you can connect from other systems outside your office? This is a problem on the MySQL server side (firewall, incorrect TCP binding, etc.). What address is MySQL listening on? Make sure that address can be accessed externally.

– John Hanley
Nov 22 '18 at 18:29





Are you sure that you can connect from other systems outside your office? This is a problem on the MySQL server side (firewall, incorrect TCP binding, etc.). What address is MySQL listening on? Make sure that address can be accessed externally.

– John Hanley
Nov 22 '18 at 18:29













Yes I'm sure. I've been using this MySQL server for a long time and accessed it from the train, from another country - hotels, etc.

– Tomer
Nov 23 '18 at 13:29





Yes I'm sure. I've been using this MySQL server for a long time and accessed it from the train, from another country - hotels, etc.

– Tomer
Nov 23 '18 at 13:29












1 Answer
1






active

oldest

votes


















2














My bad, our IT closed the 3306 port in the firewall. I tried accessing the server from outside our network and found out it wasn't accessible anymore.
Thanks for doubting me John






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431933%2fcant-connect-to-a-stand-alone-mysql-server-from-a-google-cloud-compute-vm-insta%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    My bad, our IT closed the 3306 port in the firewall. I tried accessing the server from outside our network and found out it wasn't accessible anymore.
    Thanks for doubting me John






    share|improve this answer




























      2














      My bad, our IT closed the 3306 port in the firewall. I tried accessing the server from outside our network and found out it wasn't accessible anymore.
      Thanks for doubting me John






      share|improve this answer


























        2












        2








        2







        My bad, our IT closed the 3306 port in the firewall. I tried accessing the server from outside our network and found out it wasn't accessible anymore.
        Thanks for doubting me John






        share|improve this answer













        My bad, our IT closed the 3306 port in the firewall. I tried accessing the server from outside our network and found out it wasn't accessible anymore.
        Thanks for doubting me John







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 15:35









        TomerTomer

        3371310




        3371310
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431933%2fcant-connect-to-a-stand-alone-mysql-server-from-a-google-cloud-compute-vm-insta%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith