I am trying to follow this tutorial: https://www.quantstart.com/articles/Securities-Master-Database-with-MySQL-and-Python and I am at the part where I am trying to fill a database in my SQL server, but I am getting a connection error at mdb.connect():

OperationalError: (2013, "Lost connection to MySQL server at 'waiting for initial communication packet', system error: 0")

I installed mySQL 8.0 on my Windows machine, so the tutorial doesn't help much in parts.

The things I googled said I should check if the server is running and so I tried that. I ran the status command and got:

mysql> \s
--------------
mysql  Ver 8.0.15 for Win64 on x86_64 (MySQL Community Server - GPL)

Connection id:          17
Current database:       securities_master
Current user:           [email protected]
SSL:                    Cipher in use is DHE-RSA-AES128-GCM-SHA256
Using delimiter:        ;
Server version:         8.0.15 MySQL Community Server - GPL
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    cp850
Conn.  characterset:    cp850
TCP port:               3306
Uptime:                 18 min 29 sec

Threads: 3  Questions: 21  Slow queries: 0  Opens: 127  Flush tables: 2  Open tables: 103  Queries per second avg: 0.018

So I know that the server is running and that something is interacting with my computer.

The code I have to connect is really basic just to clear out the clutter.

import MySQLdb as mdb

conn = mdb.connect('localhost', 'sec_user', '', 'securities_master', charset='utf8') 

I have a server locally hosted on my machine with a basic user and a database called 'securities_master'. I am trying to connect to it so I can start populating the tables.

I think that maybe the request isn't actually making it to my SQL server, but I am really novice at this so I have no idea where to look to see that happening.

0 Answers