The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mysql not starting

Discussion in 'General Discussion' started by cyexx, May 9, 2007.

  1. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    I had to reinstall cpanel on FreeBSD and the only problem after re-importing the accounts is

    mysql 5 is not starting

    I have tried /scripts/fixeverything // /scripts/upcp --force // /scripts/fixmysqlbsd // /scripts/mysqlup // /scripts/cleanupmysqlpervs // myisamchk -r /var/lib/mysql/*/*.MYI

    I have tried also tried updating the mysql5 server/client in ports but it says the port has not been installed so I am stuck at the moment now.

    WHM 10.8.0 cPanel 10.9.0-R10737
    FreeBSD 6.2-RELEASE i386 - WHM X v3.1.0
     
  2. AlexV.

    AlexV. Well-Known Member

    Joined:
    Jun 15, 2006
    Messages:
    212
    Likes Received:
    1
    Trophy Points:
    16
    cyexx:

    I just wanted to mention that FreeBSD still not supported.

    Nevertheless, we wouldn't mind taking a look at your server and check why MySQL is not starting up accordingly.

    Please submit a support ticket and we will check it out for you.
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Clarification

    Just to clarify, your specific version of FreeBSD (version 6.2) is not yet supported. FreeBSD is supported by cPanel, for the specific versions of FreeBSD we support please visit: http://www.cpanel.net/products/cPanelandWHM/linux/sys_requirements.htm
     
    #3 cPanelDavidG, May 9, 2007
    Last edited: May 9, 2007
  4. AlexV.

    AlexV. Well-Known Member

    Joined:
    Jun 15, 2006
    Messages:
    212
    Likes Received:
    1
    Trophy Points:
    16
    Thanks for catching that DavidG. :D

    Copy/Paste didn't grab the "6.2"
     
  5. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    I have tried starting mysql from the command line and also from WHM --- Also i have spoken with cpanel and they say FreeBSD 6.2 is not officially supported yet???

    WHM - Errors -
    Attempting to restart mysql
    Waiting for mysql to restart.... . . . . . . . . . . finished.

    mysql status

    /usr/local/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)' Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists! mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").

    ** Command Line **
    [root@alpha /var/db/mysql]# /etc/rc.d/init.d/mysql start
    [root@alpha /var/db/mysql]# mysql -v
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
    [root@alpha /var/db/mysql]#


    *** Error from phpmyadmin ***
    phpMyAdmin - error

    #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
     
  6. AlexV.

    AlexV. Well-Known Member

    Joined:
    Jun 15, 2006
    Messages:
    212
    Likes Received:
    1
    Trophy Points:
    16
    cyexx:

    What is the output from:
    less /etc/my.cnf
     
  7. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    [root@alpha ~]# less /etc/my.cnf
    [mysqld]
    set-variable = max_connections=500
    safe-show-database
    old-passwords = 1

    [root@alpha ~]#
     
  8. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    I was running 6.1 when the server rebooted after it had updated to Cpanel 11 and cpanel software hung the machine and the only thing the nocc would do is reinstall the machine, problem being they no longer will install 6.1 and installed 6.2 and then I have been dealing with cpanel on the machine since that

    also mysql was running just fine in 5.0 form after the install until such time as i had it re-import the databases for the accounts then it would not restart nor start mysql
     
  9. AlexV.

    AlexV. Well-Known Member

    Joined:
    Jun 15, 2006
    Messages:
    212
    Likes Received:
    1
    Trophy Points:
    16
    cyexx:

    What is on your mysql logs?

    Please paste the output from tail, not the entire log. :)
     
  10. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    You might be running into a conflict between securetmp and mysql, which happens occasionally. You could try adding
    Code:
    socket=/var/db/mysql/mysql.sock
    
    to the [mysqld] section of /etc/my.cnf and see whether mysql will start. The error logs will be in /var/db/mysql
     
  11. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    I have made the change for the my.cnf and its still trying to start the sock in /tmp/

    also below is a cut from the log, the last entry is repeated every few hours from cpanel auto-restarting the service

    *******

    070507 22:32:23 mysqld started
    070507 22:32:23 InnoDB: Started; log sequence number 0 32168155
    070507 22:32:23 [Note] /usr/local/libexec/mysqld: ready for connections.
    Version: '5.0.33' socket: '/tmp/mysql.sock' port: 3306 FreeBSD port: mysql-server-5.0.33
    070507 22:41:51 [Note] /usr/local/libexec/mysqld: Normal shutdown

    070507 22:41:51 InnoDB: Starting shutdown...
    070507 22:41:53 InnoDB: Shutdown completed; log sequence number 0 32168155
    070507 22:41:53 [Note] /usr/local/libexec/mysqld: Shutdown complete

    070507 22:41:53 mysqld ended

    070508 04:36:15 mysqld started
    070509 00:38:34 mysqld started
    070509 0:38:34 InnoDB: Started; log sequence number 0 32168155
    070509 0:38:34 [ERROR] /usr/local/libexec/mysqld: Can't open file: 'user.MYI' (errno: 126)
    070509 0:38:34 [ERROR] /usr/local/libexec/mysqld: Can't open file: 'user.MYI' (errno: 126)
    070509 0:38:34 [ERROR] Fatal error: Can't open and lock privilege tables: Can't open file: 'user.MYI' (errno: 126)
    070509 00:38:34 mysqld ended

    070509 00:41:54 mysqld started
    070509 0:41:55 InnoDB: Started; log sequence number 0 32168155
    070509 0:41:55 [ERROR] /usr/local/libexec/mysqld: Incorrect key file for table './mysql/user'; try to repair it
    070509 0:41:55 [ERROR] /usr/local/libexec/mysqld: Incorrect key file for table './mysql/user'; try to repair it
    070509 0:41:55 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect key file for table './mysql/user'; try to repair it
    070509 00:41:55 mysqld ended
     
  12. AndyReed

    AndyReed Well-Known Member
    PartnerNOC

    Joined:
    May 29, 2004
    Messages:
    2,222
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Minneapolis, MN
    Did the following in that order:
    /usr/local/etc/rc.d/chkservd.sh stop
    mv /var/db/mysql /var/db/mysql.out
    mkdir /var/db/mysql
    chown -R mysql:mysql /var/db/mysql
    /scripts/mysqlup --force

    If that gets MySQL up and running, you can stop MySQL and move your DBs to the new directory, restart MySQL and then fix corrupted DBs/tables using PhpMyadmin.
     
  13. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Looks like your mysql.user table is corrupt. Try to repair it, or restore it from backup.

    Code:
    mysql> use mysql;
    mysql> check table user;
    mysql> repair table user; 
    
    It could also be incorrect permissions. But more likely file corruption.
     
  14. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    **** Results below from this trial ****

    alpha# /usr/local/etc/rc.d/chkservd.sh stop
    Stopping chkservd.
    alpha# mv /var/db/mysql/ /var/db/mysql.out/
    alpha# mkdir /var/db/mysql
    alpha# chown -R mysql:mysql /var/db/mysql
    alpha# /scripts/mysqlup --force
    MySQL Setup Script Version 7.0
    This is the MySQL installer for OS FreeBSD
    mysql-client-5.0 (5.0.27) is already installed.
    mysql-client-5.0 (5.0.27) is newer then requested version 5.0.27. (no install needed)
    mysql-client-5.0 (5.0.27) is already installed.
    mysql-client-5.0 (5.0.27) is newer then requested version 5.0.27. (no install needed)
    mysql-server-5.0 (5.0.27) is already installed.
    mysql-server-5.0 (5.0.27) is newer then requested version 5.0.27. (no install needed)
    mysql-server-5.0 (5.0.27) is already installed.
    mysql-server-5.0 (5.0.27) is newer then requested version 5.0.27. (no install needed)
    Installing all prepared tables
    Fill help tables

    To start mysqld at boot time you have to copy support-files/mysql.server
    to the right place for your system

    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    /usr/local/bin/mysqladmin -u root password 'new-password'
    /usr/local/bin/mysqladmin -u root -h alpha.********.*** password 'new-password'
    See the manual for more instructions.

    You can start the MySQL daemon with:
    cd /usr/local ; /usr/local/bin/mysqld_safe &

    You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
    cd sql-bench ; perl run-all-tests

    Please report any problems with the /usr/local/bin/mysqlbug script!

    The latest information about MySQL is available on the web at
    http://www.mysql.com
    Support MySQL by buying support/licenses at http://shop.mysql.com

    Waiting for MySQL to restart ...
    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, stored procedures, or
    more secure passwords in 4.1

    You can safely ignore all 'Duplicate column' and 'Unknown column' errors
    because these just mean that your tables are already up to date.
    This script is safe to run even if your tables are already up to date!

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
    Got a failure from command:
    cat /usr/local/share/mysql/mysql_fix_privilege_tables.sql | /usr/local/bin/mysql --no-defaults --force --user=root --host=localhost --password=********* --database=mysql
    Please check the above output and try again.

    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
    Waiting for mysql to restart..............finished.


    /usr/local/bin/mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
    Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
    mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").
    Install Complete
    alpha#
     
  15. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    **** Problem ****

    I cannot run mysql commands if mysql will not start
     
  16. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    **** Attached log from new build ****

    070509 22:53:00 mysqld started
    InnoDB: The first specified data file ./ibdata1 did not exist:
    InnoDB: a new database to be created!
    070509 22:53:00 InnoDB: Setting file ./ibdata1 size to 10 MB
    InnoDB: Database physically writes the file full: wait...
    070509 22:53:00 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile0 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    070509 22:53:00 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
    InnoDB: Setting log file ./ib_logfile1 size to 5 MB
    InnoDB: Database physically writes the file full: wait...
    InnoDB: Doublewrite buffer not found: creating new
    InnoDB: Doublewrite buffer created
    InnoDB: Creating foreign key constraint system tables
    InnoDB: Foreign key constraint system tables created
    070509 22:53:00 InnoDB: Started; log sequence number 0 0
    070509 22:53:00 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070509 22:53:00 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070509 22:53:00 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
    070509 22:53:00 mysqld ended

    070509 22:53:05 mysqld started
    070509 22:53:06 InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    InnoDB: Reading tablespace information from the .ibd files...
    InnoDB: Restoring possible half-written data pages from the doublewrite
    InnoDB: buffer...
    070509 22:53:06 InnoDB: Starting log scan based on checkpoint at
    InnoDB: log sequence number 0 36808.
    InnoDB: Doing recovery: scanned up to log sequence number 0 43655
    070509 22:53:06 InnoDB: Starting an apply batch of log records to the database...
    InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    InnoDB: Apply batch completed
    070509 22:53:06 InnoDB: Started; log sequence number 0 43655
    070509 22:53:06 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070509 22:53:06 [ERROR] /usr/local/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
    070509 22:53:06 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
    070509 22:53:06 mysqld ended
     
  17. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Yeah, my apologies for that spectacularly bad advice. No Excuses, I just wasn't thinking at the moment.

    YOu can use the myisamchk tool to do this:

    Code:
    root@c5edge-2 [/var/lib/mysql]# myisamchk -s mysql/*.MYI
    root@c5edge-2 [/var/lib/mysql]# myisamchk -r mysql/*.MYI
    
    The first command will only print errors, rather than everything found. THe second will force a repair. ON FreeBSD, the databases will likely be in /var/db/mysql/mysql. YOu can execute the command from anywhere, as long as you provide the path to the database files.

    Also check out the other options available with myisamchk --help
     
  18. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    **** Dump from run ****

    [root@alpha /]# cd /var/lib/mysql
    [root@alpha /var/lib/mysql]# myisamchk -s mysql/*.MYI
    [root@alpha /var/lib/mysql]# myisamchk -r mysql/*.MYI
    - recovering (with sort) MyISAM-table 'mysql/columns_priv.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/db.MYI'
    Data records: 2
    - Fixing index 1
    - Fixing index 2

    ---------

    - recovering (with sort) MyISAM-table 'mysql/func.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/help_category.MYI'
    Data records: 36
    - Fixing index 1
    - Fixing index 2

    ---------

    - recovering (with sort) MyISAM-table 'mysql/help_keyword.MYI'
    Data records: 381
    - Fixing index 1
    - Fixing index 2

    ---------

    - recovering (with sort) MyISAM-table 'mysql/help_relation.MYI'
    Data records: 733
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/help_topic.MYI'
    Data records: 462
    - Fixing index 1
    - Fixing index 2

    ---------

    - recovering (with sort) MyISAM-table 'mysql/host.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/proc.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/procs_priv.MYI'
    Data records: 0
    - Fixing index 1
    - Fixing index 2

    ---------

    - recovering (with sort) MyISAM-table 'mysql/tables_priv.MYI'
    Data records: 0
    - Fixing index 1
    - Fixing index 2

    ---------

    - recovering (with sort) MyISAM-table 'mysql/time_zone.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/time_zone_leap_second.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/time_zone_name.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/time_zone_transition.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/time_zone_transition_type.MYI'
    Data records: 0
    - Fixing index 1

    ---------

    - recovering (with sort) MyISAM-table 'mysql/user.MYI'
    Data records: 4
    - Fixing index 1
    [root@alpha /var/lib/mysql]#


    *** Start Error ***

    /usr/local/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)' Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists! mysql has failed, please contact the sysadmin (result was "Warning, no valid mysql.sock file found.mysql has failed").
     
  19. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    is there any way to remove and reinstall the mysql server/client on the machine since the cpanel script is not using the standard ports for mysql to install with so i cannot do a deinstall and install to bring it back online, I have the data backed up I just need a working mysql server, since I have about 30 sites on that server that require Mysql and have customers screaming at me
     
  20. cyexx

    cyexx Well-Known Member

    Joined:
    Sep 3, 2004
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
Loading...

Share This Page