can't start mysql anymore

12,954

permissions on my.cnf were incorrect. They have to be:

-rw-r--r-- 1 root root 3505 apr 22 09:56 my.cnf
Share:
12,954

Related videos on Youtube

dot
Author by

dot

Updated on May 26, 2022

Comments

  • dot
    dot almost 2 years

    I was trying to restart my "mysql" services after increasing the max_allowed_packet value

    When I did the restart, I got this message:

    jm@dev:/etc/mysql$ /etc/init.d/mysql restart
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service mysql restart
    
    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the stop(8) and then start(8) utilities,
    e.g. stop mysql ; start mysql. The restart(8) utility is also available.
    stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.481" (uid=1000 pid=6732 comm="stop mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
    

    The changes to the max_allowed_packet didn't seem to kick in so then I tried :

    jm@dev:/etc/mysql$ sudo stop mysql
    [sudo] password for jm: 
    mysql stop/waiting
    jm@dev:/etc/mysql$ sudo start mysql
    start: Job failed to start
    

    I tried to check the log files for errors but /var/log/mysql/mysql.log is empty.

    Any suggestions on how I can troubleshoot this? Thanks.

    EDIT 1

    Here's what my my.cnf looks like:

    #
    # 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
    #
    user            = mysql
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    port            = 3306
    basedir         = /usr
    datadir         = /var/lib/mysql
    tmpdir          = /tmp
    lc-messages-dir = /usr/share/mysql
    skip-external-locking
    local-infile
    
    #
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    #
    # * Fine Tuning
    #
    key_buffer              = 16M
    max_allowed_packet      = 40M
    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
    #
    # Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
    #
    # 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
    local-infile
    
    [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.
    #
    

    EDIT 2

    Found the following entries in syslog:

    Sep 17 14:48:30 dev kernel: [456044.062568] init: mysql main process (8723) terminated with status 1
    Sep 17 14:48:30 dev kernel: [456044.062606] init: mysql main process ended, respawning
    Sep 17 14:48:31 dev kernel: [456045.071308] init: mysql post-start process (8724) terminated with status 1
    Sep 17 14:48:31 dev kernel: [456045.080818] type=1400 audit(1379443711.030:42): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=8749 comm="apparmor_parser"
    Sep 17 14:48:31 dev kernel: [456045.094878] init: mysql main process (8753) terminated with status 1
    Sep 17 14:48:31 dev kernel: [456045.094911] init: mysql main process ended, respawning
    Sep 17 14:48:32 dev kernel: [456046.103060] init: mysql post-start process (8754) terminated with status 1
    Sep 17 14:48:32 dev kernel: [456046.112910] type=1400 audit(1379443712.062:43): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=8777 comm="apparmor_parser"
    Sep 17 14:48:32 dev kernel: [456046.128208] init: mysql main process (8781) terminated with status 1
    Sep 17 14:48:32 dev kernel: [456046.128240] init: mysql respawning too fast, stopped
    
    • Ander2
      Ander2 over 10 years
      Look into syslog for errors. The logs are being redirected there.
    • dot
      dot over 10 years
      Ander2 I found some messages in syslog. GOing to google them now... but if you have any suggestions please let me know. Check out my edit 2
    • Ander2
      Ander2 over 10 years
      Have a look to apparmor's configuration files for mysql. Check paths are correct and match you my.cnf file's paths.
    • dot
      dot over 10 years
      Ander2, I'm sorry, but I don't understand when you say to check out apparmor's configuration files... how do i do that? sorry... just a newbie. Will double check the paths.
    • Ander2
      Ander2 over 10 years
      Loot at /etc/apparmor.d/ folder. There should be a file like usr.sbin.mysqld. Open it and check the paths.
    • dot
      dot over 10 years
      ok one thing i see is that apparmor.d refers to : /var/run/mysqld/mysqld.pid w, /var/run/mysqld/mysqld.sock w, /run/mysqld/mysqld.pid w, /run/mysqld/mysqld.sock w, but those files don't exist. the directories do...
    • Jim Garrison
      Jim Garrison over 10 years
      Off-topic for SO; belongs on Server Fault
  • dot
    dot over 10 years
    I didn't uninstall/ install .. it was working fine until i did a restart..
  • Jon Lin
    Jon Lin over 10 years
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
  • JohnnyFaldo
    JohnnyFaldo over 10 years
    @JonLin this is an answer from op on his own question