Can't connect to a stand alone MySQL server from a google cloud compute VM instance
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
add a comment |
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
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
add a comment |
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
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
mysql google-cloud-platform google-compute-engine
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered Nov 25 '18 at 15:35


TomerTomer
3371310
3371310
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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