mysql - 无法启动mysql了

标签 mysql linux ubuntu-12.04

<分区>

我试图在增加 max_allowed_pa​​cket 值后重新启动我的“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_pa​​cket 的更改似乎没有生效,所以我尝试了:

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

编辑 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

最佳答案

my.cnf 的权限不正确。 它们必须是:

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

关于mysql - 无法启动mysql了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18857261/

相关文章:

PHP Mysql 检查结束时间是否小于 2.50 小时并更新记录

php - 在 PHP 中获取 Contact Form 7 表单 ID

bash - 如何在 unix 终端模拟器中使用脚本命令?

java - 显示 MySQL 数据库中保存的消息

java - BoneCP 正在报告未关闭的连接,但我在所有获得新连接的地方都使用 try-with-resource

c++ - Linux - 检测闲置

linux - 无法在交互式命令行应用程序中对上一个命令使用箭头键

linux - 从 telegraf 到 influxdb 的输入没有测量结果

gcc - Ubuntu (12.10) 和 GCC 4.7/4.8 有什么问题?

ruby-on-rails - 有没有办法从 AIFF 文件中删除 IDV 标签?