无法启动 MySQL 服务器 - 控制进程退出,错误代码
Unable to start MySQL server - Control process exited with error code
我的 mysql 服务器在停止后没有启动
命令使用:
sudo /etc/init.d/mysql restart
错误:
Restarting mysql (via systemctl): mysql.serviceJob for mysql.service
failed because the control process exited with error code.
使用 systemctl status mysql.service
和 journalctl -xe
检查状态,没有得到任何帮助。
错误日志:
-
2020-06-23T00:11:48.882919Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option (see documentation for more details).
2020-06-23T00:11:48.883135Z 0 [Warning] Can't create test file /u1/mysql/sad-swh.lower-test
2020-06-23T00:11:48.883185Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.30-0ubuntu0.18.04.1) starting as process 28411 ...
2020-06-23T00:11:48.886131Z 0 [Warning] Can't create test file /u1/mysql/sad-swh.lower-test
2020-06-23T00:11:48.886148Z 0 [Warning] Can't create test file /u1/mysql/sad-swh.lower-test
2020-06-23T00:11:48.889591Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-06-23T00:11:48.889612Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-06-23T00:11:48.889616Z 0 [Note] InnoDB: Uses event mutexes
2020-06-23T00:11:48.889620Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-06-23T00:11:48.889623Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-06-23T00:11:48.889627Z 0 [Note] InnoDB: Using Linux native AIO
2020-06-23T00:11:48.889890Z 0 [Note] InnoDB: Number of pools: 1
2020-06-23T00:11:48.890022Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-06-23T00:11:48.892207Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-06-23T00:11:48.900818Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-06-23T00:11:48.903535Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be
changed. See the man page of setpriority().
2020-06-23T00:11:48.913543Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will
be created!
2020-06-23T00:11:48.913858Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-23T00:11:48.913871Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-23T00:11:48.913878Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-06-23T00:11:48.913883Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-06-23T00:11:48.913889Z 0 [ERROR] InnoDB: Cannot open datafile './ibdata1'
2020-06-23T00:11:48.913896Z 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to
the system tablespace, and it failed here, you should now edit
innodb_data_file_path in my.cnf back to what it was, and remove the
new ibdata files InnoDB created in this failed attempt. InnoDB only
wrote those files full of zeros, but did not yet use them in any way.
But be careful: do not remove old data files which contain your
precious data!
2020-06-23T00:11:48.913903Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Cannot open a file. You may need to
delete the ibdata1 file before trying to start up again.
2020-06-23T00:11:49.514733Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-06-23T00:11:49.514763Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-06-23T00:11:49.514773Z 0 [ERROR] Failed to initialize builtin plugins.
2020-06-23T00:11:49.514779Z 0 [ERROR] Aborting
2020-06-23T00:11:49.514817Z 0 [Note] Binlog end
2020-06-23T00:11:49.514889Z 0 [Note] Shutting down plugin 'CSV'
2020-06-23T00:11:49.515486Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service;
enabled;
vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2020-06-22 16:07:36 CST;
9min ago Process: 26756 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE) Process: 26737 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 18936 (code=exited, status=0/SUCCESS)
使用这些命令解决了问题
sudo chmod a+rwx mysql /location
sudo chown mysql.mysql /location
Mysql 服务器在我的新 Ubuntu 18.04 实例上意外停止,并在尝试启动时遇到同样的错误。
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
当运行命令systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-08-29 17:11:53 UTC; 11s ago
Process: 3124 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Main PID: 2557 (code=exited, status=0/SUCCESS)
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: mysql.service: Control process exited, code=exited status=1
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: Failed to start MySQL Community Server.
在网上搜索了将近 6 个小时后,终于找到了解决方案。
sudo chmod -R u+rwx /etc/mysql/
sudo chown -R mysql.mysql /etc/mysql/
在我的例子中,是 RAM。
But if you are on a 512MB droplet running both git and a full
WordPress, then it is expected to run out of RAM. It’s actually quite
difficult to run WordPress on 512MB.
I would generally say that WordPress needs 1GB RAM minimum in
production. You might be able to run on 512MB, but if just a couple of
people visit your site at the same time and WordPress is checking for
updates, then you can easily run out of RAM.
我的问题是执行以下命令:
chown mysql:adm /var/log/mysql/error.log
chown mysql:adm /var/log/mysql
chown root:syslog /var/log
chown root:root /var
chmod 0640 /var/log/mysql/error.log
chmod 0750 /var/log/mysql
chmod 0775 /var/log
chmod 0755 /var
系统状态mysql.service
我的 mysql 服务器在停止后没有启动
命令使用:
sudo /etc/init.d/mysql restart
错误:
Restarting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code.
使用 systemctl status mysql.service
和 journalctl -xe
检查状态,没有得到任何帮助。
错误日志:
-
2020-06-23T00:11:48.882919Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use
--explicit_defaults_for_timestamp server option (see documentation for more details).
2020-06-23T00:11:48.883135Z 0 [Warning] Can't create test file /u1/mysql/sad-swh.lower-test 2020-06-23T00:11:48.883185Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.30-0ubuntu0.18.04.1) starting as process 28411 ... 2020-06-23T00:11:48.886131Z 0 [Warning] Can't create test file /u1/mysql/sad-swh.lower-test 2020-06-23T00:11:48.886148Z 0 [Warning] Can't create test file /u1/mysql/sad-swh.lower-test 2020-06-23T00:11:48.889591Z 0 [Note] InnoDB: PUNCH HOLE support available 2020-06-23T00:11:48.889612Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2020-06-23T00:11:48.889616Z 0 [Note] InnoDB: Uses event mutexes 2020-06-23T00:11:48.889620Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2020-06-23T00:11:48.889623Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2020-06-23T00:11:48.889627Z 0 [Note] InnoDB: Using Linux native AIO 2020-06-23T00:11:48.889890Z 0 [Note] InnoDB: Number of pools: 1 2020-06-23T00:11:48.890022Z 0 [Note] InnoDB: Using CPU crc32 instructions 2020-06-23T00:11:48.892207Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2020-06-23T00:11:48.900818Z 0 [Note] InnoDB: Completed initialization of buffer pool 2020-06-23T00:11:48.903535Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be
changed. See the man page of setpriority().
2020-06-23T00:11:48.913543Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will
be created!
2020-06-23T00:11:48.913858Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation. 2020-06-23T00:11:48.913871Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. 2020-06-23T00:11:48.913878Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation. 2020-06-23T00:11:48.913883Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory. 2020-06-23T00:11:48.913889Z 0 [ERROR] InnoDB: Cannot open datafile './ibdata1' 2020-06-23T00:11:48.913896Z 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to
the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2020-06-23T00:11:48.913903Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Cannot open a file. You may need to
delete the ibdata1 file before trying to start up again.
2020-06-23T00:11:49.514733Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 2020-06-23T00:11:49.514763Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2020-06-23T00:11:49.514773Z 0 [ERROR] Failed to initialize builtin plugins. 2020-06-23T00:11:49.514779Z 0 [ERROR] Aborting 2020-06-23T00:11:49.514817Z 0 [Note] Binlog end 2020-06-23T00:11:49.514889Z 0 [Note] Shutting down plugin 'CSV' 2020-06-23T00:11:49.515486Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service;
enabled;
vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2020-06-22 16:07:36 CST;
9min ago Process: 26756 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE) Process: 26737 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 18936 (code=exited, status=0/SUCCESS)
使用这些命令解决了问题
sudo chmod a+rwx mysql /location
sudo chown mysql.mysql /location
Mysql 服务器在我的新 Ubuntu 18.04 实例上意外停止,并在尝试启动时遇到同样的错误。
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
当运行命令systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2020-08-29 17:11:53 UTC; 11s ago
Process: 3124 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Main PID: 2557 (code=exited, status=0/SUCCESS)
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: mysql.service: Control process exited, code=exited status=1
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 29 17:11:53 ip-172-26-10-122 systemd[1]: Failed to start MySQL Community Server.
在网上搜索了将近 6 个小时后,终于找到了解决方案。
sudo chmod -R u+rwx /etc/mysql/
sudo chown -R mysql.mysql /etc/mysql/
在我的例子中,是 RAM。
But if you are on a 512MB droplet running both git and a full WordPress, then it is expected to run out of RAM. It’s actually quite difficult to run WordPress on 512MB.
I would generally say that WordPress needs 1GB RAM minimum in production. You might be able to run on 512MB, but if just a couple of people visit your site at the same time and WordPress is checking for updates, then you can easily run out of RAM.
我的问题是执行以下命令:
chown mysql:adm /var/log/mysql/error.log
chown mysql:adm /var/log/mysql
chown root:syslog /var/log
chown root:root /var
chmod 0640 /var/log/mysql/error.log
chmod 0750 /var/log/mysql
chmod 0775 /var/log
chmod 0755 /var
系统状态mysql.service