MySQL不会在Ubuntu服务器16.04上重新启动

时间:2018-07-09 18:52:07

标签: mysql ubuntu-16.04 ubuntu-server

Mysql不会再次重新启动,出现此错误:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

和这里的尾部错误日志:

sudo tail -30 /var/log/mysql/error.log
2018-07-09T18:22:31.107868Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-07-09T18:22:31.204826Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-07-09T18:22:31.707270Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-07-09T18:22:31.707323Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-07-09T18:22:31.709057Z 0 [Warning] InnoDB: 1048576 bytes should have been written. Only 376832 bytes written. Retrying for the remaining bytes.
2018-07-09T18:22:31.709080Z 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
2018-07-09T18:22:31.709092Z 0 [ERROR] InnoDB: Write to file ./ibtmp1failed at offset 2097152, 1048576 bytes should have been written, only 376832 were written. Operating system error number 28. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded.
2018-07-09T18:22:31.709103Z 0 [ERROR] InnoDB: Error number 28 means 'No space left on device'
2018-07-09T18:22:31.709110Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
2018-07-09T18:22:31.709119Z 0 [ERROR] InnoDB: Could not set the file size of './ibtmp1'. Probably out of disk space
2018-07-09T18:22:31.709126Z 0 [ERROR] InnoDB: Unable to create the shared innodb_temporary
2018-07-09T18:22:31.709133Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-07-09T18:22:32.210454Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-07-09T18:22:32.210480Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-07-09T18:22:32.210490Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-07-09T18:22:32.210500Z 0 [ERROR] Failed to initialize builtin plugins.
2018-07-09T18:22:32.210508Z 0 [ERROR] Aborting

2018-07-09T18:22:32.210527Z 0 [Note] Binlog end
2018-07-09T18:22:32.219434Z 0 [Note] Shutting down plugin 'MyISAM'
2018-07-09T18:22:32.219459Z 0 [Note] Shutting down plugin 'CSV'

请问有人有这个错误吗?

2 个答案:

答案 0 :(得分:1)

我认为在这种情况下,仔细阅读邮件可以为您提供很大帮助。您的消息说...

  

2018-07-09T18:22:31.709092Z 0 [错误] InnoDB:写入文件./ibtmp1在偏移2097152处失败,应该已写入1048576个字节,仅写入了376832个字节。操作系统错误号28。检查操作系统和文件系统是否支持此大小的文件。还要检查磁盘是否已满或超出磁盘配额。

     

2018-07-09T18:22:31.709103Z 0 [错误] InnoDB:错误号28表示“设备上没有剩余空间”

看起来存放MySQL数据的磁盘已满。做df -h

Filesystem Size Used Avail Use% Mounted on 
/dev/root  20G   19G    0  100%  / 
devtmpfs  7.9G     0 7.9G    0%  /dev 
tmpfs     7.9G     0 7.9G    0%  /dev/shm 
tmpfs     7.9G   14M 7.9G    1%  /run 
tmpfs     5.0M     0 5.0M    0%  /run/lock 
tmpfs     7.9G     0 7.9G    0%  /sys/fs/cgroup 
tmpfs     7.9G     0 7.9G    0%  /run/shm 
/dev/sda2 487M   22M 437M    5%  /boot 
/dev/sda4 1.8T  376M 1.7T    1%  /home

Ubuntu / Debian将MySQL放在/ var / lib / mysql中。在您的机器上,/var在根文件系统上,首先显示在df输出中。 该文件系统已满。

不知道系统上还有什么,很难确切地告诉您该怎么做。但是,您的/ var目录树需要在更大的文件系统上,或者您需要弄清楚如何将MySQL数据放在/ home下。

答案 1 :(得分:0)

MYQL无法启动,因为Journalctl输出表明,但是您尚未提供必需的服务器ID。按照下面的代码所示,添加必填ID。

/etc/mysql/mysql.conf.d/mysqld.cnf

更改自:

log-bin=mysql-bin
binlog-format = 'ROW'

更改为:

server-id=master-01
log-bin=mysql-bin
binlog-format = 'ROW'

这将使您的服务器运行,同时解决所需日志记录的正确格式。

非致命警告:

对于错误的打开文件限制,您将不得不使用以下方法来减少对编辑配置的需求,或者通过以下方式增加系统的限制:

/etc/security/limits.conf

* soft nofile [new number]
* hard nofile [new number]

第一列描述了向谁申请限额。 ''是通配符,表示所有用户。要提高root用户的限制,您必须明确输入“ root”而不是“。”。