comtersoft » mysql
Call us today at US: 703 - 349 - 1168 | India: +91 471 - 301 0690

Archive for the ‘mysql’ Category

Importing Mysql Database using command Prompt

Posted on October 13th, 2009 in mysql | 101 Comments »

 

Importing Mysql Database using command Prompt

We can import Mysql database using command line

We can use the ’source’ command to import database

Syntax :

use database name

source .sql file name along path

Example
use my_data1

source c:\db\mydata.sql

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

Posted on August 6th, 2009 in mysql | No Comments »

 

If you are getting this error

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

then these steps should help you solve it.

  1. Ensure that the user ‘mysql’ has complete access to the mysql folder and all the files in it.
    chmod -R mysql.root /var/lib/mysql/*
    90% of the time this should solve your issue. If not, try the next step.
  2. Try to locate the path to the file ‘mysqld.sock’.
    Case 1:
    If you find it and it is not in the location as specified in the error message then create a symlink to the file in the expected directory. For example, in our error message mysqld.sock is expected to be in the var/run/mysqld/ folder.

    Case 2:
    You cannot locate a file  ’mysqld.sock’ at all. In this case you try to locate ‘mysqld’
    (Remember that mysqld is NOT a folder but a file.)
    locate mysqld
    Create a symlink to this file in the expected directory. For example:
    cd /var/run/mysqld/
    ln -s /usr/sbin/mysqld mysqld.sock

Thats its! Now when you restart your MySQL all should work fine.
/etc/init.d/mysql restart

Note:

Our server is Ubuntu 8.04 server with MySQL Ver 14.12 Distrib 5.0.51a
When the MySQL partition became full the MySQL service stopped(crashed). Restarting the service after creating free space resulted in the error discussed.

Reference link: http://forums.mysql.com/read.php?11,9689,14974#msg-14974

The secret of getting ahead is getting started. ComterSoft is the starting point