Monday, October 27, 2008

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I'm currently using lampp-1.6.6 as my php/mysql server in my ubuntu 7.10.

It's very easy to use.. especially when I want to use mysql database server. I just go to their phpmyadmin to create database, import, view, insert, etc..

But the lack is when I want to using import facilities..it has maximum file size to uploaded, that is 2,048 KiB

So, what I must to do when I have to import more that 2MB file size is using mysql from terminal/console..

It seems simply to just use this command:
# mysql -u [username] -p [password] [database_to_restore] < [backupfile]

but it always returned this error:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

what's wrong...??

I search in google to find out if there anyone have the same problem like I have...

yes there are so many people have that problem..


I try one by one solution they recommended but it still fail..

Then, I go to directory /opt/lampp-1.6.6/bin
then I repeat my command one more time.. but it still failed..

Then I change the command just to add ./ that is:
# ./mysql -u [username] -p [password] [database_to_restore] < [backupfile]

then it worked???

My analysis is when I type command:
# mysql -u [username] -p [password] [database_to_restore] < [backupfile]

without "./" it will refer to default mysql server which it not currently installed.

SO, of course it will failed...

Bu when I added "./" and I do that in lampp directory it will refering to mysql in lampp..

Hmm I don't know yet how to make mysql in lampp being default mysql database server

No comments:

Post a Comment