Python connect to remote mysql failed

  • updated
  • Answered

I am using python to connect to mysql server,and get this error,

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

Hello, I'm sorry to hear that your Python code is having problems connecting with your MySQL server. In researching the issue it appears that there multiple possible causes to the connection not working. This forum post talks about the issue on multiple levels. You may want review some of the responses there in order to see if they match up with your problem. You should also test your remote MySQL connection using the credentials that you have added in cPanel to see if the connection works outside of your code. Try using a MySQL client to test. I hope this helps to answer your question, please let us know if you require any further assistance. Regards, Arnel C.