Mysql fails to run after reboot using crontab
<p>I have made a script which saves data to Mysql database using mysqldp and python. When I run script from console (python myscript.py) it works, but when I run it on reboot using Crontab I get an email with following error:</p>

<blockquote>
  <p><strong>_mysql_exceptions.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")</strong> </p>
</blockquote>

<p>When I try to run the script using <strong>Crontab</strong> not on reboot, but accordingly to time I don't get following error. </p>

<p>Maybe you have some ideas? </p>

<p>What if I would call the same script with <code>while(1)</code> loop once and once again (It will start the new background task every time)?</p>

<p>Thanks to Shadow's hint I have solved the problem.
I just have started the <strong>Mysql</strong> server manually from the script and now it works.</p>

<p>I have used this command to start the server</p>

<blockquote>
  <p><strong>from subprocess import call</strong></p>
  
  <p><strong>call(['sudo','service','mysql','start'])</strong></p>
</blockquote>

python mysql crontab