me,myself,english and programming..

Gambas – Can’t connect to local MySQL server through socket workaround

Previously I write about Gambas programming and my temporary solution for connecting to MySQL error.

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Well, it’s really temporary where the link file that I create previously gone missing whenever I restart my pc. I then need to run the command again and again. Until today I still can’t find the solution.

Here are my workaround for this problem.

It’s just a simple workaround where we just need to create a script and start it at bootup.

Write a simple script and put it in /etc/init.d/ directory.

Add up two line of below command in the script.

sudo mkdir /var/run/mysqld
sudo ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock

Once completed, run this command at terminal.

sudo chmod +x MyScriptName
sudo update-rc.d MyScriptName defaults
That's all. Happy programming :)

reference:

Start Script at bootup

Post a Comment