[Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Pocket

Xampp is my favourite webserver for linux as well as windows for web development works. And while importing huge mysql database dumps I use the commandline tool in windows as well as linux. And I often find myself so irritating to the error messages as follows :

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

Error 2002 (Hy000)

When mysql is unable to find the appropriate socket to connect with the service, then we get the above error.

The above error can be solved by two different ways.
1. By specifying the correct socket in php.ini settings
2. By creating symbolic link to the appropriate socket file.

I will explain step 2 : How to view the correct socket file to create symbolic link ?

Use command below to identify the correct socket file in use

samundra@samundra-apple:~$ ps -aux | grep mysqld

Output will be something like below ::

root      6244  0.0  0.0   1912   572 pts/0    S    14:41   0:00 /bin/sh /opt/lampp/bin/mysqld_safe --datadir=/opt/lampp/var/mysql --pid-file=/opt/lampp/var/mysql/samundra-apple.pid
nobody    6291  0.1  0.3  32636 13700 pts/0    Sl   14:41   0:09 /opt/lampp/sbin/mysqld --basedir=/opt/lampp --datadir=/opt/lampp/var/mysql --user=nobody --pid-file=/opt/lampp/var/mysql/samundra-apple.pid --skip-external-locking --port=3306 --socket=/opt/lampp/var/mysql/mysql.sock
samundra  8370  0.0  0.0   4160   856 pts/0    S+   16:01   0:00 grep --color=auto mysqld

See the screenshot below
MySql Process Dump
What we just did was that we first verified that the mysqld (service for mysql) is currently running and then we retreived the file in use by the process.

In above output we can see

--socket=/opt/lampp/var/mysql/mysql.sock

This is the required file, where we will create our symbolic link. Now all we have to do is execute the following command.

samundra@samundra-apple:~$ cd /var/run/
samundra@samundra-apple:~$ sudo mkdir mysqld
samundra@samundra-apple:~$ ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock

See the screenshot below for symblic link pointing to the /opt/lampp/var/mysql/mysql.sock file.
Symbolic Link

The above has to be carried out each time you restart linux, so to make things easier what we can do is create a script and execute it manually. It can also be set to execute at boot time, You can google for that part.

I created a file mysql.sh having contents

#!/bin/bash
sudo rm -rf /var/run/mysqld
sudo mkdir /var/run/mysqld
sudo ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysql.sock

then I changed the mysql.sh permission to execute.

samundra@samundra-apple:~$ chmod u+x mysql.sh

To execute use the following command:

samundra@samundra-apple:~$ ./mysql.sh

It will ask me my admins password and then will do the rest of the job of creating symbolic links and all.

How to install TweetDeck in Natty Narwhal (Ubuntu11.04)

Pocket

Tweetdeck requires to have adobe air pre-installed.

Visit my previous article http://www.samundra.com.np/how-to-install-tweetdeck-in-natty-narwhal-ubuntu-11-04/553 To install Adobe Air

If you have already installed Adobe Air, You can skip the above step 1.

At first visit the website : http://www.tweetdeck.com/desktop/

There you’ll see a Download Button at the bottom right corner. (see the screenshot below).

Download now - tweetdeck

Click “Download now” button,

After, you click the button changes to “installing TweetDeck” (see the screenshot below), it should get you a setup file.
Installing TweetDeck - tweetdeck

Just click on open to run the setup file(screenshot below)
Open or Save TweetDeck - tweetdeck

Note : You can also click on save and execute it later to actually install the Tweet Deck Application.

That’s all, Now you should have TweetDeck installed in your Ubuntu box, if you have exactly followed the steps above.

Hope you liked the article.

Happy Tweeting 😀

How to install Adobe Air in Natty Narwhal (Ubuntu 11.04)

Pocket

To install TweetDeck first we need to install the Adobe Air

To install adobe air visit the following site.

  1. http://get.adobe.com/air/

From The Selection Combo Box select .deb (see the screenshot below – step1.png)

Adobe Air Installations
Adobe Air Installations

After that you will get a Download now button Click on that button.

Then you will have a installer file adobeair.deb

Double click or Right-click on this adobeair.deb file and open with ubuntu software center, install the application. (See the screenshot below – open_with_ubuntu_software_center.png )

Open with Ubuntu Software Center
Open with Ubuntu Software Center

During installation, you may be asked to confirm the installation telling that the source is untrusted because it doesn’t have standard maintainer or something like that. Just ignore it and hit the Yes Button. What all it means is that in future we won’t be able to update it directly as other packages in Ubuntu but we’ll need to upgrade it ourselves in case new packages arrive in the market 😀

After you successfully Install the adobe air, Its time to actually install the TweetDeck.

For next part Visit my post How to Install TweetDeck in Natty Narwhal (Ubuntu11.04)

[Solved] Video playback failed in firefox in ubuntu

Pocket

This occur when there is conflict in players in firefox for ubuntu.

To remove the conflict install the Flash-Aid plugin for firefox. Get it Here

After installing Flash-Aid run it for the first time, in wizard mode.

This addon will list all the flash player installed in the system. If this list the gnash as installed, then you’ll need to remove it from the system. To do it open the Synaptic Packet Manager.

From the synaptic packet manager uninstall the gnash. And then restart the firefox. Bingo !!! The videos will be played in firefox.

If this doesn’t help you, there might be other flash tools that might be conflicting with each other.