MySQL doesn't work after reboot

Discussion in 'Installation/Configuration' started by bswinnerton, Aug 12, 2010.

  1. bswinnerton

    bswinnerton New Member

    I'm using an OpenVZ container and every time that I reboot the server, MySQL stops working.

    Now a simple /etc/init.d/mysql restart fixes it, but this is incredibly annoying.

    When trying to acces MySQL after a reboot I get:

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

    /var/run/mysqld doesn't exist until after I reboot the service.
     
  2. bswinnerton

    bswinnerton New Member

    I'm baffled. I've tried:

    1. Adding mysql to rc.d:

    Code:
    update-rc.d mysql defaults
    update-rc.d: warning: /etc/init.d/mysql missing LSB information
    update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
     Adding system startup for /etc/init.d/mysql ...
       /etc/rc0.d/K20mysql -> ../init.d/mysql
       /etc/rc1.d/K20mysql -> ../init.d/mysql
       /etc/rc6.d/K20mysql -> ../init.d/mysql
       /etc/rc2.d/S20mysql -> ../init.d/mysql
       /etc/rc3.d/S20mysql -> ../init.d/mysql
       /etc/rc4.d/S20mysql -> ../init.d/mysql
       /etc/rc5.d/S20mysql -> ../init.d/mysql
    
    I've tried editing /etc/init/mysql.conf to add my interface adapter (which happens to be venet0

    Code:
    start on (net-device-up IFACE=venet0
              and local-filesystems
              and runlevel [2345])
    stop on runlevel [016]
    
    And still no luck! There doesn't seem to be anything really in the error logs, and my.cnf looks like this:

    Code:
    #
    # The MySQL database server configuration file.
    #
    # You can copy this to one of:
    # - "/etc/mysql/my.cnf" to set global options,
    # - "~/.my.cnf" to set user-specific options.
    # 
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
    
    # This will be passed to all mysql clients
    # It has been reported that passwords should be enclosed with ticks/quotes
    # escpecially if they contain "#" chars...
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    [client]
    port		= 3306
    socket		= /var/run/mysqld/mysqld.sock
    
    # Here is entries for some specific programs
    # The following values assume you have at least 32M ram
    
    # This was formally known as [safe_mysqld]. Both versions are currently parsed.
    [mysqld_safe]
    socket		= /var/run/mysqld/mysqld.sock
    nice		= 0
    
    [mysqld]
    #
    # * Basic Settings
    #
    
    #
    # * IMPORTANT
    #   If you make changes to these settings and your system uses apparmor, you may
    #   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
    #
    
    user		= mysql
    socket		= /var/run/mysqld/mysqld.sock
    port		= 3306
    basedir		= /usr
    datadir		= /var/lib/mysql
    tmpdir		= /tmp
    skip-external-locking
    #
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    #bind-address		= 127.0.0.1
    #
    # * Fine Tuning
    #
    key_buffer		= 16M
    max_allowed_packet	= 16M
    thread_stack		= 192K
    thread_cache_size       = 8
    # This replaces the startup script and checks MyISAM tables if needed
    # the first time they are touched
    myisam-recover         = BACKUP
    #max_connections        = 100
    #table_cache            = 64
    #thread_concurrency     = 10
    #
    # * Query Cache Configuration
    #
    query_cache_limit	= 1M
    query_cache_size        = 16M
    #
    # * Logging and Replication
    #
    # Both location gets rotated by the cronjob.
    # Be aware that this log type is a performance killer.
    # As of 5.1 you can enable the log at runtime!
    #general_log_file        = /var/log/mysql/mysql.log
    #general_log             = 1
    
    log_error                = /var/log/mysql/error.log
    
    # Here you can see queries with especially long duration
    #log_slow_queries	= /var/log/mysql/mysql-slow.log
    #long_query_time = 2
    #log-queries-not-using-indexes
    #
    # The following can be used as easy to replay backup logs or for replication.
    # note: if you are setting up a replication slave, see README.Debian about
    #       other settings you may need to change.
    #server-id		= 1
    #log_bin			= /var/log/mysql/mysql-bin.log
    expire_logs_days	= 10
    max_binlog_size         = 100M
    #binlog_do_db		= include_database_name
    #binlog_ignore_db	= include_database_name
    #
    # * InnoDB
    #
    # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
    # Read the manual for more InnoDB related options. There are many!
    #
    # * Security Features
    #
    # Read the manual, too, if you want chroot!
    # chroot = /var/lib/mysql/
    #
    # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
    #
    # ssl-ca=/etc/mysql/cacert.pem
    # ssl-cert=/etc/mysql/server-cert.pem
    # ssl-key=/etc/mysql/server-key.pem
    
    
    
    [mysqldump]
    quick
    quote-names
    max_allowed_packet	= 16M
    
    [mysql]
    #no-auto-rehash	# faster start of mysql but no tab completition
    
    [isamchk]
    key_buffer		= 16M
    
    #
    # * IMPORTANT: Additional settings that can override those from this file!
    #   The files must end with '.cnf', otherwise they'll be ignored.
    #
    !includedir /etc/mysql/conf.d/
    
    And just for kicks, here's /var/log/mysql/error.log:

    Code:
    100812 15:39:32 [Note] Plugin 'FEDERATED' is disabled.
    InnoDB: The first specified data file ./ibdata1 did not exist:
    InnoDB: a new database to be created!
    100812 15:39:32  InnoDB: Setting file ./ibdata1 size to 10 MB
    InnoDB: Database physically writes the file full: wait...
    100812 15:39:32  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...
    100812 15:39:32  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
    100812 15:39:32  InnoDB: Started; log sequence number 0 0
    100812 15:39:32  InnoDB: Starting shutdown...
    100812 15:39:33  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 15:39:33 [Note] Plugin 'FEDERATED' is disabled.
    100812 15:39:33  InnoDB: Started; log sequence number 0 44233
    100812 15:39:33  InnoDB: Starting shutdown...
    100812 15:39:35  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 15:39:35 [Note] Plugin 'FEDERATED' is disabled.
    100812 15:39:35  InnoDB: Started; log sequence number 0 44233
    ERROR: 1064  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT ' at line 1
    100812 15:39:35 [ERROR] Aborting
    
    100812 15:39:35  InnoDB: Starting shutdown...
    100812 15:39:36  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 15:39:36 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 15:39:36 [Note] Plugin 'FEDERATED' is disabled.
    100812 15:39:36  InnoDB: Started; log sequence number 0 44233
    100812 15:39:36  InnoDB: Starting shutdown...
    100812 15:39:37  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 15:39:37 [Note] Plugin 'FEDERATED' is disabled.
    100812 15:39:37  InnoDB: Started; log sequence number 0 44233
    ERROR: 1050  Table 'plugin' already exists
    100812 15:39:37 [ERROR] Aborting
    
    100812 15:39:37  InnoDB: Starting shutdown...
    100812 15:39:39  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 15:39:39 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 15:39:39 [Note] Plugin 'FEDERATED' is disabled.
    100812 15:39:39  InnoDB: Started; log sequence number 0 44233
    100812 15:39:39 [Note] Event Scheduler: Loaded 0 events
    100812 15:39:39 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.41-3ubuntu12.6'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
    100812 15:40:18 [Note] /usr/sbin/mysqld: Normal shutdown
    
    100812 15:40:18 [Note] Event Scheduler: Purging the queue. 0 events
    100812 15:40:18  InnoDB: Starting shutdown...
    100812 15:40:19  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 15:40:19 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 15:40:19 [Note] Plugin 'FEDERATED' is disabled.
    100812 15:40:19  InnoDB: Started; log sequence number 0 44233
    100812 15:40:19 [Note] Event Scheduler: Loaded 0 events
    100812 15:40:19 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.41-3ubuntu12.6'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
    100812 16:00:11 [Note] /usr/sbin/mysqld: Normal shutdown
    
    100812 16:00:11 [Note] Event Scheduler: Purging the queue. 0 events
    100812 16:00:11  InnoDB: Starting shutdown...
    100812 16:00:12  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 16:00:12 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 16:00:12 [Note] Plugin 'FEDERATED' is disabled.
    100812 16:00:12  InnoDB: Started; log sequence number 0 44233
    100812 16:00:12 [Note] Event Scheduler: Loaded 0 events
    100812 16:00:12 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.41-3ubuntu12.6'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
    100812 16:13:26 [Note] /usr/sbin/mysqld: Normal shutdown
    
    100812 16:13:26 [Note] Event Scheduler: Purging the queue. 0 events
    100812 16:13:26  InnoDB: Starting shutdown...
    100812 16:13:26  InnoDB: Shutdown completed; log sequence number 0 44233
    100812 16:13:26 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 16:15:53 [Note] Plugin 'FEDERATED' is disabled.
    100812 16:15:53  InnoDB: Started; log sequence number 0 44233
    100812 16:15:53 [Note] Event Scheduler: Loaded 0 events
    100812 16:15:53 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.41-3ubuntu12.6'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
    100812 20:43:08 [Note] /usr/sbin/mysqld: Normal shutdown
    
    100812 20:43:08 [Note] Event Scheduler: Purging the queue. 0 events
    100812 20:43:08  InnoDB: Starting shutdown...
    100812 20:43:11  InnoDB: Shutdown completed; log sequence number 0 169887
    100812 20:43:11 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 20:45:55 [Note] Plugin 'FEDERATED' is disabled.
    100812 20:45:55  InnoDB: Started; log sequence number 0 169887
    100812 20:45:55 [Note] Event Scheduler: Loaded 0 events
    100812 20:45:55 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.41-3ubuntu12.6'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
    100812 23:41:01 [Note] /usr/sbin/mysqld: Normal shutdown
    
    100812 23:41:01 [Note] Event Scheduler: Purging the queue. 0 events
    100812 23:41:01  InnoDB: Starting shutdown...
    100812 23:41:02  InnoDB: Shutdown completed; log sequence number 0 169887
    100812 23:41:02 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 23:43:02 [Note] Plugin 'FEDERATED' is disabled.
    100812 23:43:02  InnoDB: Started; log sequence number 0 169887
    100812 23:43:02 [ERROR] Can't start server : Bind on unix socket: No such file or directory
    100812 23:43:02 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
    100812 23:43:02 [ERROR] Aborting
    
    100812 23:43:02  InnoDB: Starting shutdown...
    100812 23:43:03  InnoDB: Shutdown completed; log sequence number 0 169887
    100812 23:43:03 [Note] mysqld: Shutdown complete
    
    100812 23:43:07 [Note] Plugin 'FEDERATED' is disabled.
    100812 23:43:07  InnoDB: Started; log sequence number 0 169887
    100812 23:43:07 [ERROR] Can't start server : Bind on unix socket: No such file or directory
    100812 23:43:07 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
    100812 23:43:07 [ERROR] Aborting
    
    100812 23:43:07  InnoDB: Starting shutdown...
    100812 23:43:08  InnoDB: Shutdown completed; log sequence number 0 169887
    100812 23:43:08 [Note] mysqld: Shutdown complete
    
    100812 23:43:34 [Note] Plugin 'FEDERATED' is disabled.
    100812 23:43:34  InnoDB: Started; log sequence number 0 169887
    100812 23:43:34 [Note] Event Scheduler: Loaded 0 events
    100812 23:43:34 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.41-3ubuntu12.6'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
    100812 23:48:01 [Note] /usr/sbin/mysqld: Normal shutdown
    
    100812 23:48:01 [Note] Event Scheduler: Purging the queue. 0 events
    100812 23:48:01  InnoDB: Starting shutdown...
    100812 23:48:03  InnoDB: Shutdown completed; log sequence number 0 169887
    100812 23:48:03 [Note] /usr/sbin/mysqld: Shutdown complete
    
    100812 23:49:21 [Note] Plugin 'FEDERATED' is disabled.
    100812 23:49:21  InnoDB: Started; log sequence number 0 169887
    100812 23:49:21 [Note] Event Scheduler: Loaded 0 events
    100812 23:49:21 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.41-3ubuntu12.6'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
    
     
  3. vogelor

    vogelor ISPConfig Developer

    Sorry, i cant help you in your case. i can only tel you, that i am using mysql in OpenVz too and it works fine at several server.

    maybe a

    aptitude purge mysql
    aptitude install mysql

    will help

    ATTENTION: if you do this, your will lose your data, so make a backup before!
     
  4. falko

    falko Super Moderator

    How much free space do you have in your VM?
     
  5. bswinnerton

    bswinnerton New Member

    @Falko:
    Code:
    root@CW-WS2:~# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/simfs             20G  1.8G   19G   9% /
    varrun                512M   80K  512M   1% /var/run
    varlock               512M     0  512M   0% /var/lock
    @vogelor, this is the second openvz container I run that has the same problem, I don't think that reinstalling mysql will help.
     
  6. falko

    falko Super Moderator

    Looks ok. What does
    Code:
    cat /proc/user_beancounters
    show?
     
  7. bswinnerton

    bswinnerton New Member

    Code:
    root@CW-WS2:~# cat /proc/user_beancounters
    Version: 2.5
           uid  resource                     held              maxheld              barrier                limit              failcnt
        33050:  kmemsize                 19053795             22830537             67108864             67108864                    0
                lockedpages                     0                 1006                 1024                 1024                    0
                privvmpages                240824               263369               262144               262144                  380
                shmpages                     3983                 7929               102400               102400                    0
                dummy                           0                    0                    0                    0                    0
                numproc                        92                  114                  640                  640                    0
                physpages                  127816               182223                    0  9223372036854775807                    0
                vmguarpages                     0                    0               131072  9223372036854775807                    0
                oomguarpages               127834               182223               104857  9223372036854775807                    0
                numtcpsock                     27                   64                 1024                 1024                    0
                numflock                       15                   27                 2048                 2048                    0
                numpty                          1                    3                   64                   64                    0
                numsiginfo                      0                   18                 1024                 1024                    0
                tcpsndbuf                  419536              1034600              5368709             10737418                    0
                tcprcvbuf                  405504              3468144              5368709             10737418                    0
                othersockbuf               266928               439808              2684354              5368709                    0
                dgramrcvbuf                     0               114752              1342177              2684354                    0
                numothersock                  156                  220                 1024                 1024                    0
                dcachesize                      0                    0              8053063             12582912                    0
                numfile                      2279                 2990                32768                32768                    0
                dummy                           0                    0                    0                    0                    0
                dummy                           0                    0                    0                    0                    0
                dummy                           0                    0                    0                    0                    0
                numiptent                      30                   35                 1536                 1536                    0
    
     
  8. falko

    falko Super Moderator

    I think you should give the VM more memory.
     
  9. bswinnerton

    bswinnerton New Member

    Alright, I upgraded my package to one with more memory, but it still doesn't start at boot.
     
  10. bswinnerton

    bswinnerton New Member

    Fixed it!

    Change /etc/init/mysql.conf from this:
    Code:
    start on (net-device-up
              and local-filesystems
              and runlevel [2345])
    stop on runlevel [016]
    
    to this:
    Code:
    start on (local-filesystems
              and runlevel [2345])
    stop on runlevel [016]
    
     
  11. Num85

    Num85 New Member

    *BUMP*
    I'm having the same problem with my MySQL on Ubuntu 11.10. Everything worked fine until I rebooted my pc now I can't login to phpmyadmin, the mysql has stopped responding and my site (installed locally) is offline.
    I tried rebooting mysql (/etc/init.d/mysql restart) but this doesn't work, I also tried editing the /etc/init/mysql.conf file but this doesn't work either.
    Does anyone know of anything else I can do to get this working again?

    Also I didn't back up my database in phpmyadmin, in case I can't get back in is there any other way to access the database?
     

Share This Page