无法启动MySQL了

3

我尝试在将max_allowed_packet值增加后重启“mysql”服务。

当我进行重启时,出现了以下信息:

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")

更改max_allowed_packet似乎没有生效,于是我尝试了以下操作:
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

我尝试查看日志文件以查找错误,但是/var/log/mysql/mysql.log为空。

有什么建议可以帮助我解决这个问题吗?谢谢。

编辑1

这是我的my.cnf文件:

#
# 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

在系统日志中找到以下条目:


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 我在系统日志中发现了一些消息。现在去谷歌它们...但如果你有任何建议,请告诉我。请查看我的编辑2。 - dot
Ander2,抱歉,我不明白你说的检查apparmor配置文件是什么意思...我该怎么做?抱歉...我只是个新手。我会再次检查路径。 - dot
查看/etc/apparmor.d/文件夹。应该有一个名为usr.sbin.mysqld的文件。打开它并检查路径。 - Ander2
好的,我看到一个问题是apparmor.d引用了以下内容: /var/run/mysqld/mysqld.pid w, /var/run/mysqld/mysqld.sock w, /run/mysqld/mysqld.pid w, /run/mysqld/mysqld.sock w, 但这些文件不存在。只有目录存在... - dot
显示剩余2条评论
2个回答

2

我的.cnf文件的权限不正确。必须是:

-rw-r--r-- 1 root root 3505 apr 22 09:56 my.cnf

这并没有提供问题的答案。如果您想对作者进行批评或请求澄清,请在他们的帖子下留言。 - Jon Lin
@JonLin 这是原帖作者对自己问题的回答。 - JohnnyFaldo

0

我没有卸载/安装..直到我重启前一切都正常。 - dot

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接