I am trying to upload data from Raspbian to my web server which is PHPMyAdmin MySQL type.

I am trying to do this using Python 3, as follows:

import pymysql as ps
con = ps.connect(host='ip address of host', database='database_name', user='database_user',passwd='password')
c6s = con.cursor()
sqlcmd = """ INSERT INTO {} (value1,value2,value3,value4,value5) VALUES(%s,%s,%s,%s,%s)""".format('table_name')
c6s.execute(sqlcmd, (data[0],data[1],data[2],data[3],data[4]))
print("%s uploaded on cloud " % (db))

The error code is 2003.

1 Answer 1


2003 indicates that the remote host refused connection. Set up mysql to allow remote connections. This is typically done with the bind-adress directive in mysql config.

https://support.servergrove.com/how-do-i-enable-remote-access-to-mysql-database-server/ contains some information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.