I have a problem with my script starting on boot up. If I start my script from the command prompt it works fine, if I start it from a cron job on boot I get a mysql connection error.
Traceback (most recent call last):
File "/home/pi/CoopControl/server.py", line 53, in <module>
mariadb_connection = mariadb.connect(host="localhost",user='root', password='some password', database='Chicken')
File "/usr/lib/python2.7/dist-packages/mysql/connector/__init__.py", line 179, in connect
return MySQLConnection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 94, in __init__
File "/usr/lib/python2.7/dist-packages/mysql/connector/abstracts.py", line 722, in connect
File "/usr/lib/python2.7/dist-packages/mysql/connector/connection.py", line 207, in _open_connection
File "/usr/lib/python2.7/dist-packages/mysql/connector/network.py", line 512, in open_connection
errno=2003, values=(self.get_address(), _strioerror(err)))
mysql.connector.errors.InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' (111 Connection refused)
I have changed localhost to 127.0.0.1 and I get the same error, in my script I haven't specified a port number so I am not sure where 3306 has come from. Also why would my connection be refused only when the scripts starting on boot?
Can anyone help??