【发布时间】:2020-06-22 22:16:08
【问题描述】:
我的mysql服务器停止后没有启动
命令使用:
sudo /etc/init.d/mysql restart
错误:
重启mysql(通过systemctl):mysql.serviceJob for mysql.service 失败,因为控制进程以错误代码退出。
使用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 服务器选项(有关详细信息,请参阅文档)。
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改变了。请参阅 setpriority() 的手册页。
2020-06-23T00:11:48.913543Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will被创造!
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系统表空间,在这里失败了,你现在应该编辑 将 my.cnf 中的 innodb_data_file_path 恢复为原来的样子,并删除 在这次失败的尝试中创建了新的 ibdata 文件 InnoDB。仅限 InnoDB 写了那些全是零的文件,但还没有以任何方式使用它们。 但要小心:不要删除包含您的旧数据文件 宝贵的数据!
2020-06-23T00:11:48.913903Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Cannot open a file. You may need to在尝试重新启动之前删除 ibdata1 文件。
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)
【问题讨论】:
-
这里是状态 - ● mysql.service - MySQL Community Server Loaded: 已加载 (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: failed (Result: exit -code) 自 2020 年 6 月 22 日星期一 16:07:36 CST 起; 9 分钟前 进程:26756 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE) 进程:26737 ExecStartPre=/usr/share /mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 18936 (code=exited, status=0/SUCCESS)
-
你应该在你的问题中添加 mysql 错误日志
-
日志添加@nbk
-
你把好的部分剪掉了,不要遗漏任何东西,这样我们就看不出是什么问题了
-
它说得很清楚无法打开数据文件'./ibdata1'所以mysql在数据目录中拥有正确的权限,所以设置权限并且所有东西都应该运行。当你看到阅读错误日志时,它会告诉你你需要做的一切
标签: mysql ubuntu mysql-error-1064