Help talk:Toolforge/Database/Archives/2016
Appearance
Latest comment: 8 years ago by Vladis13 in topic No external access to database by Python
![]() |
Please do not post any new comments on this page. This is a discussion archive See current discussion or the archives index. |
No external access to database by Python
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'enwiki.labsdb:3306' ([Errno 11001] getaddrinfo failed)")
sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (2005, "Unknown MySQL server host 'ruwiki.labsdb' (0)")
I get this errors when try run a scripts from my computer (tried modules pymysql and sqlalchemy). On the server it works without problem. Script like:
import pymysql.cursors
connection = pymysql.connect(host='enwiki.labsdb:3306',
user=u,
password=pw,
db='enwiki_p',
charset='utf8',
cursorclass=pymysql.cursors.DictCursor)
Also I tried open SSH-connect from the script, but it not help. (Schema: open ssh, test ok, try access to db - get the errors, close ssh.). --Vladis13 (talk) 04:51, 23 September 2016 (UTC)
- The MySQL servers are not open to the outside world; they are only accessible from inside the labs network. If you want to connect from your local computer, see Help:Tool_Labs/Database#Steps_to_setup_SSH_tunneling_for_testing_a_tool_labs_application_which_makes_use_of_tool_labs_databases_on_your_own_computer on tunneling over SSH. valhallasw (Merlijn van Deen) (talk) 06:20, 23 September 2016 (UTC)
- I found problem. 1) In Windows no the tool "ssh" about talk the Help. Instead can use the PuTTY (I did add this in Help.). 2) In module pymysql need set port like:
pymysql.connect(host='127.0.0.1', port=4711
, but notpymysql.connect(host='127.0.0.1:4711'
. --Vladis13 (talk) 07:15, 23 September 2016 (UTC) - SQLAlchemy.py not works on server. It requires module MySQLdb.py which not installed there. --Vladis13 (talk) 07:58, 23 September 2016 (UTC)
- I found problem. 1) In Windows no the tool "ssh" about talk the Help. Instead can use the PuTTY (I did add this in Help.). 2) In module pymysql need set port like: