在重新启动服务器之后,我就不能再启动mysql了。
我遵循了以下几个解决方案:
我运行以下命令来启动服务:
mysql
>> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
sudo service mysql start
>> 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 Wed 2022-01-26 15:18:33 UTC; 47s ago
Process: 2612 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
journalctl -xe
>> Startup of the manager took 379405 microseconds.
Jan 26 14:33:24 sumentserver polkit-agent-helper-1[2223]: pam_unix(polkit-1:auth): authentication failure; logname= uid=1001 euid=0 tty= >
-- Reboot --
Jan 26 14:44:33 sumentserver systemd[1685]: Reached target Paths.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
服务器拥有Ubuntu20.4
关于我能做什么有什么建议吗?
发布于 2022-01-26 08:58:51
我今天也面临着同样的问题,问题的来源可能是不同的,但是仔细阅读/var/log/mysql/error.log
,它应该指向错误。
我删除了一个不需要.MYD
和.MYI
文件的表。这是一个错误,我应该删除表,但我的服务器是100%的内存使用。
我所做的就是在以下内容中看到错误:
sudo tail -f /var/log/mysql/error.log
保持两个终端同时打开,第一次运行
sudo tail -f /var/log/mysql/error.log
在第一个终端上运行,然后在第二个终端上运行。
sudo systemctl stop mysql.service ---to shut it down
sudo systemctl start mysql.service ---to try and start up and see the reason why it is not starting.
对我来说是:
2022-01-26T16:30:36.213788Z 0 [Note] InnoDB: Database was not shutdown normally!
2022-01-26T16:30:36.213802Z 0 [Note] InnoDB: Starting crash recovery.
2022-01-26T16:30:36.213830Z 0 [ERROR] InnoDB: Tablespace 605 was not found at ./contratti/ip_log2_bak.ibd.
2022-01-26T16:30:36.213840Z 0 [ERROR] InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace.
2022-01-26T16:30:36.644359Z 0 [ERROR] InnoDB: Cannot continue operation.
2022-01-26T16:30:38.045091Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-01-26T16:30:38.062994Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.34-log) starting as process 2843 ...
2022-01-26T16:30:38.416074Z 0 [Note] InnoDB: PUNCH HOLE support available
我可以通过在/etc/mysql/mysql.conf.d/mysqld.cnf
上添加
innodb_force_recovery = 2
来自MySQL文档
如果您能够转储innodb_force_recovery值为3或更少的表,则相对安全,只丢失一些损坏页上的数据。
在这个改变之后,我停止并重新启动了MySQL,它运行得很好。
发布于 2022-01-26 09:07:35
在从@Ergest Basha中调试commens之后,在检查日志之后,它看起来像是一个配置问题:
2022-01-26T15:10:01.855905Z0 错误 服务器 /usr/sbin/mysqld:在设置值'ONLY_FULL_GROUP_BY、STRICT_TRANS_TABLES、ERROR_FOR_DIVISION_BY_ZERO、NO_AUTO_CREATE_USER、NO_ENGINE_SUBS>时出错
回滚到默认
https://dba.stackexchange.com/questions/306615
复制