0

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]))
con6s.commit()
con6s.close()
print("%s uploaded on cloud " % (db))

The error code is 2003.

Aurora0001
6,3773 gold badges25 silver badges40 bronze badges
asked Sep 15, 2017 at 11:19

1 Answer 1

0

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.

answered Sep 15, 2017 at 20:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.