Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2006
    Location
    Vietnam
    Posts
    95

    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/li

    Heloo,

    Because mistake, i delete folder /var/lib/mysql , and all database lost, after i restore backup from WHM, but after restore it error:


    Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /home/host4net/public_html/maincore.php on line 131
    Unable to connect to SQL Server


    All website have database also same error, please help me soon, thank you verry much.

  2. #2
    Make sure that :

    1) Mysql is running on the server and 'ps aux | grep mysql' shows mysql threads running.

    2) Goto /var/lib/mysql/mysql folder which is where the data for the main 'mysql' database is stored and make sure that the files below are present.

    ----------------------------
    columns_priv.MYD
    columns_priv.MYI
    columns_priv.frm
    db.MYD
    db.MYI
    db.frm
    func.MYD
    func.MYI
    func.frm
    host.MYD
    host.MYI
    host.frm
    tables_priv.MYD
    tables_priv.MYI
    tables_priv.frm
    user_info.frm
    user_info.MYD
    user_info.MYI
    user.MYD
    user.MYI
    user.frm
    ----------------------------

    3) Also make sure that the folder /var/lib/mysql and all files/folders under it are owned by the user: group - mysql : mysql.

    Regards,
    Rose
    rose@instacarma.com
    Regards,
    Rose [rose@instacarma.com]
    InstaCarma.com
    24x7 Technical Support and Server Management

  3. #3
    Join Date
    Aug 2001
    Posts
    4,537
    Have a look here.
    Sitemeer.com ● Multi-Location Service Availability Check
    Not just HTTP! Proper HTTPS support, detailed timing statistics and full IDN compliance


  4. #4
    Join Date
    Mar 2006
    Location
    Vietnam
    Posts
    95
    Quote Originally Posted by InstaCarma_Rose
    Make sure that :

    1) Mysql is running on the server and 'ps aux | grep mysql' shows mysql threads running.

    2) Goto /var/lib/mysql/mysql folder which is where the data for the main 'mysql' database is stored and make sure that the files below are present.

    ----------------------------
    columns_priv.MYD
    columns_priv.MYI
    columns_priv.frm
    db.MYD
    db.MYI
    db.frm
    func.MYD
    func.MYI
    func.frm
    host.MYD
    host.MYI
    host.frm
    tables_priv.MYD
    tables_priv.MYI
    tables_priv.frm
    user_info.frm
    user_info.MYD
    user_info.MYI
    user.MYD
    user.MYI
    user.frm
    ----------------------------

    3) Also make sure that the folder /var/lib/mysql and all files/folders under it are owned by the user: group - mysql : mysql.

    Regards,
    Rose
    rose@instacarma.com
    Yes, all thing right, because after i deleted folder /var/lib/mysql , i restore with backup daily in WHM, and also check again, all thing right, but can't connect

    Thanks.

  5. #5
    Join Date
    Mar 2006
    Location
    Vietnam
    Posts
    95
    SQL ServicesShow MySQL Processes (WHM) display:

    +----+------+-----------+----+---------+------+-------+------------------+
    | Id | User | Host | db | Command | Time | State | Info |
    +----+------+-----------+----+---------+------+-------+------------------+
    | 18 | root | localhost | | Query | 0 | | show processlist |
    +----+------+-----------+----+---------+------+-------+------------------+


    ============
    root@fast [~]# service mysql restart
    Shutting down MySQL. [ OK ]
    Starting MySQL [ OK ]
    root@fast [~]# ps aux | grep mysq
    root 5775 0.0 0.0 5976 1220 pts/0 S 17:40 0:00 /bin/sh /usr/bin/ mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/fast.4netvn.com.p id
    mysql 5807 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5808 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5809 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5810 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5811 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5812 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5813 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5814 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5815 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    mysql 5816 0.0 0.5 32124 11872 pts/0 S 17:40 0:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/fast .4netvn.com.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
    root 5876 0.0 0.0 4660 648 pts/0 R+ 17:43 0:00 grep mysq


    ============
    root@fast [/var/lib/mysql/mysql]# ls -l
    total 544
    drwx------ 2 mysql mysql 4096 Mar 9 17:11 ./
    drwxrwx--- 60 mysql mysql 4096 Mar 9 17:40 ../
    -rw-rw---- 1 mysql mysql 8820 Mar 9 17:11 columns_priv.frm
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 columns_priv.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 columns_priv.MYI
    -rw-rw---- 1 mysql mysql 9178 Mar 9 17:11 db.frm
    -rw-rw---- 1 mysql mysql 28578 Mar 9 17:29 db.MYD
    -rw-rw---- 1 mysql mysql 8192 Mar 9 17:29 db.MYI
    -rw-rw---- 1 mysql mysql 8665 Mar 9 17:11 func.frm
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 func.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 func.MYI
    -rw-rw---- 1 mysql mysql 8700 Mar 9 17:11 help_category.frm
    -rw-rw---- 1 mysql mysql 864 Mar 9 17:11 help_category.MYD
    -rw-rw---- 1 mysql mysql 3072 Mar 9 17:11 help_category.MYI
    -rw-rw---- 1 mysql mysql 8612 Mar 9 17:11 help_keyword.frm
    -rw-rw---- 1 mysql mysql 6780 Mar 9 17:11 help_keyword.MYD
    -rw-rw---- 1 mysql mysql 11264 Mar 9 17:11 help_keyword.MYI
    -rw-rw---- 1 mysql mysql 8630 Mar 9 17:11 help_relation.frm
    -rw-rw---- 1 mysql mysql 4932 Mar 9 17:11 help_relation.MYD
    -rw-rw---- 1 mysql mysql 9216 Mar 9 17:11 help_relation.MYI
    -rw-rw---- 1 mysql mysql 8770 Mar 9 17:11 help_topic.frm
    -rw-rw---- 1 mysql mysql 189056 Mar 9 17:11 help_topic.MYD
    -rw-rw---- 1 mysql mysql 15360 Mar 9 17:11 help_topic.MYI
    -rw-rw---- 1 mysql mysql 9148 Mar 9 17:11 host.frm
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 host.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 host.MYI
    -rw-rw---- 1 mysql mysql 8925 Mar 9 17:11 tables_priv.frm
    -rw-rw---- 1 mysql mysql 11914 Mar 9 17:11 tables_priv.MYD
    -rw-rw---- 1 mysql mysql 5120 Mar 9 17:13 tables_priv.MYI
    -rw-rw---- 1 mysql mysql 8636 Mar 9 17:11 time_zone.frm
    -rw-rw---- 1 mysql mysql 8624 Mar 9 17:11 time_zone_leap_second.frm
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 time_zone_leap_second.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 time_zone_leap_second.MYI
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 time_zone.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 time_zone.MYI
    -rw-rw---- 1 mysql mysql 8606 Mar 9 17:11 time_zone_name.frm
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 time_zone_name.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 time_zone_name.MYI
    -rw-rw---- 1 mysql mysql 8686 Mar 9 17:11 time_zone_transition.frm
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 time_zone_transition.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 time_zone_transition.MYI
    -rw-rw---- 1 mysql mysql 8748 Mar 9 17:11 time_zone_transition_type.frm
    -rw-rw---- 1 mysql mysql 0 Mar 9 17:11 time_zone_transition_type.MYD
    -rw-rw---- 1 mysql mysql 1024 Mar 9 17:11 time_zone_transition_type.MYI
    -rw-rw---- 1 mysql mysql 9992 Mar 9 17:11 user.frm
    -rw-rw---- 1 mysql mysql 4228 Mar 9 17:30 user.MYD
    -rw-rw---- 1 mysql mysql 2048 Mar 9 17:30 user.MYI


    ============

    root@fast [/var/lib/mysql]# ls -l
    total 20852
    drwxrwx--- 60 mysql mysql 4096 Mar 9 17:40 ./
    drwxr-xr-x 17 root root 4096 Mar 9 16:05 ../
    drwx------ 2 mysql mysql 4096 Mar 9 17:22 domains/
    -rw-rw---- 1 mysql mysql 5 Mar 9 17:40 fast.4netvn.com.pid
    -rw-rw---- 1 mysql mysql 6 Mar 9 17:11 fast.pid
    drwx------ 2 mysql mysql 4096 Mar 9 17:22 forum4n/
    drwx------ 2 mysql mysql 4096 Mar 9 17:22 forum4n_forumhost/
    drwx------ 2 mysql mysql 4096 Mar 9 17:22 gamervie/
    drwx------ 2 mysql mysql 12288 Mar 9 17:22 gamervie_gdgdata/
    drwx------ 2 mysql mysql 4096 Mar 9 17:22 gamervie_wishdb/
    drwx------ 2 mysql mysql 4096 Mar 9 17:11 horde/
    drwx------ 2 mysql mysql 4096 Mar 9 17:20 host4net/
    drwx------ 2 mysql mysql 4096 Mar 9 17:20 host4net_host/
    drwx------ 2 mysql mysql 4096 Mar 9 17:22 hotro4n/
    drwx------ 2 mysql mysql 4096 Mar 9 17:22 hotro4n_cps1/
    -rw-rw---- 1 mysql mysql 10485760 Mar 9 17:40 ibdata1
    -rw-rw---- 1 mysql mysql 5242880 Mar 9 17:40 ib_logfile0
    -rw-rw---- 1 mysql mysql 5242880 Mar 9 16:05 ib_logfile1
    drwx------ 2 mysql mysql 4096 Mar 9 17:24 mars2it_dsrpg2/
    drwx------ 2 mysql mysql 4096 Mar 9 17:24 mars2it_Itemviet/
    drwx------ 2 mysql mysql 4096 Mar 9 17:24 mars2it_sdrpg/
    drwx------ 2 mysql mysql 4096 Mar 9 17:24 mars2it_Wish/
    drwx------ 2 mysql mysql 4096 Mar 9 17:48 mysql/
    srwxrwxrwx 1 mysql mysql 0 Mar 9 17:40 mysql.sock=
    drwx------ 2 mysql mysql 4096 Mar 9 17:25 netvnb/
    Last edited by MarsNIIT; 03-09-2006 at 06:57 AM.

  6. #6
    It looks like the mysql server is running as your 'ps' output shows mysqld processes running, and the problem is while users try to connect to the mysql interface. Try running these two scripts and see if it helps.

    /scripts/fixmysql
    /usr/bin/mysql_fix_privilege_tables

    Regards,
    Rose
    rose@instacarma.com
    Regards,
    Rose [rose@instacarma.com]
    InstaCarma.com
    24x7 Technical Support and Server Management

  7. #7
    Join Date
    Mar 2006
    Location
    Vietnam
    Posts
    95
    I just truy two script , but still have error

    root@fast [/var/lib/mysql]# /scripts/fixmysql
    root@fast [/var/lib/mysql]# /usr/bin/mysql_fix_privilege_tables
    This script updates all the mysql privilege tables to be usable by
    MySQL 4.0 and above.
    This is needed if you want to use the new GRANT functions,
    CREATE AGGREGATE FUNCTION, or the more secure passwords in 4.1
    Got a failure from command:
    /usr/bin/mysql --no-defaults --force --user=root --host=localhost --database=mysql
    Please check the above output and try again.
    Running the script with the --verbose option may give you some information
    of what went wrong.
    If you get an 'Access denied' error, you should run this script again and
    give the MySQL root user password as an argument with the --password= option
    root@fast [/var/lib/mysql]#

  8. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •