Linux mysql 服务器 5.6 无法启动,或者重新启动

Linux mysql 服务器 5.6 无法启动,或者重新启动

我的 mysql 服务器有问题;它不想启动,您有什么想法吗

谢谢。

    janv. 29 10:51:15 clicshopping mysqld_safe[20076]: 160129 10:51:15 mysqld_safe Can't log to error log and syslog at the same time.  Remove all --log-error configuration options for --syslog to take effect.
janv. 29 10:51:15 clicshopping mysqld_safe[20076]: 160129 10:51:15 mysqld_safe Logging to '/var/log/mysql/error.log'.
janv. 29 10:51:15 clicshopping mysqld_safe[20076]: 160129 10:51:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
janv. 29 10:51:15 clicshopping mysqld_safe[20076]: 160129 10:51:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
janv. 29 10:51:55 clicshopping sudo[19837]: pam_unix(sudo:session): session closed for user root

我的过程

sudo service mysql stop
sudo service apparmor stop
sudo mv /var/lib/mysql /home/mysql
sudo ln -s /home/mysql /var/lib/mysql
sudo chown -R mysql:mysql /home/mysql
vi /etc/apparmor.d/usr.sbin.mysqld (change var/lib/mysql ot /home/mysql)
sudo service apparmor start
sudo service mysql start

删除 /var/log/mysql/error.log 后:结果

mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-01-29 11:21:17 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-29 11:21:17 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28-0ubuntu0.15.10.1) starting as process 27093 ...
2016-01-29 11:21:17 27093 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2016-01-29 11:21:17 27093 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

2016-01-29 11:21:17 27093 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
2016-01-29 11:21:17 27093 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
2016-01-29 11:21:17 27093 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-01-29 11:21:17 27093 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-01-29 11:21:17 27093 [Note] InnoDB: The InnoDB memory heap is disabled
2016-01-29 11:21:17 27093 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-01-29 11:21:17 27093 [Note] InnoDB: Memory barrier is not used
2016-01-29 11:21:17 27093 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-01-29 11:21:17 27093 [Note] InnoDB: Using Linux native AIO
2016-01-29 11:21:17 27093 [Note] InnoDB: Not using CPU crc32 instructions
2016-01-29 11:21:17 27093 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-01-29 11:21:17 27093 [Note] InnoDB: Completed initialization of buffer pool

答案1

Starting mysqld daemon with databases from /var/lib/mysql

您没有更改 /etc/my.cnf 中的 datadir 或发行版放置它的位置。将其更改为datadir=/home/mysql应该可以解决您的问题。

答案2

似乎您的“mysql.plugin”表不存在或者 mysql 数据目录不属于 mysql 用户。

答案3

第一行就告诉了你这个问题:

janv. 29 10:51:15 clicshopping mysqld_safe[20076]: 160129 10:51:15 mysqld_safe 无法同时记录到错误日志和系统日志。删除所有 --log-error 配置选项以使 --syslog 生效。

您对此的回应是这样的:

在 var/log/mysql/error.log 中,我删除了所有数据,不起作用:见上文

但是你错过了重点!MySql 并不关心该文件中是否有数据。它关心的是您是否仍在尝试将新数据写入该文件。您需要更改配置文件所以您一开始就永远不会尝试写入该日志。或者,您可以删除该--syslog选项。您可以写入其中一个日志位置,而不是两个。

另外,你到底对插件表做了什么!?

2016-01-29 11:21:17 27093 [错误] 无法打开 mysql.plugin 表。请运行 mysql_upgrade 来创建它。

按照它的建议,尝试运行mysql_upgrade

相关内容