I am using OpenWrt in Arduino Yun. I want to save some sensors data into MySQL Server which is installed in OpenWrt localhost.

But it gives an error when I try to login MySQL after reboot the system.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld.sock' (2)

if i reinstall it start working but this error came after each reboot.

opkg update
opkg install mysql-server

sed -i 's,^datadir.*,datadir         = "/srv/mysql",g' /etc/my.cnf
sed -i 's,^tmpdir.*,tmpdir          = "/tmp",g' /etc/my.cnf

mkdir -p /srv/mysql
mysql_install_db --force
/etc/init.d/mysqld start
/etc/init.d/mysqld enable

please help me to resolve this issue so MySQL works every time after reboot also.

  • Can you see if mysqld is actually running after a reboot? If not, and you just run the "start" command, does it start working for that session? – Majenko Mar 28 '16 at 11:14
  • /etc/init.d/mysqld start /etc/init.d/mysqld restart both not working – ANKIT JAIN Mar 28 '16 at 12:08
  • it starts after reinstall only... – ANKIT JAIN Mar 28 '16 at 12:08
  • What, if anything, is mounted on /srv? – Majenko Mar 28 '16 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.