更改 my.cf 后 MySQL 无法启动

2023-02-07数据库问题
8

本文介绍了更改 my.cf 后 MySQL 无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在一个网站上工作,我收到了这个 MySQL 错误:

I'm working on a website and I'm getting this MySQL error:

"(...) 这与 sql_mode=only_full_group_by (...) 不兼容"

"(...) this is incompatible with sql_mode=only_full_group_by (...)"

我一直在寻找答案,但我意识到我必须更改 MySQL 的 sql_mode.所以我在/etc/mysql/my.cnf 中添加了以下行:

I've looked for an answer and I realized I had to change the sql_mode of my MySQL. So I've added the following line to /etc/mysql/my.cnf:

sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

但是现在当我执行 sudo service mysql restart 时,它需要很长时间,然后显示此消息:

But now when I executed sudo service mysql restart it takes a really long time and then shows this message:

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

所以现在我删除了该行,每次启动 PC 时都必须手动执行该命令.

So now I removed that line and I have to execute the command by hand everytime I boot my PC.

有人可以帮我吗?

推荐答案

我没有更改文件 /etc/mysql/my.cnf,而是应用了 /etc/中的更改mysql/mysql.conf.d/mysqld.cnf 文件,终于成功了.

Instead of changing the file /etc/mysql/my.cnf, I applied the changes in the /etc/mysql/mysql.conf.d/mysqld.cnf file and it worked, finally.

这篇关于更改 my.cf 后 MySQL 无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

Mysql目录里的ibtmp1文件过大造成磁盘占满的解决办法
ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致...
2025-01-02 数据库问题
151

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

MySQL groupwise MAX() 返回意外结果
MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)...
2024-04-16 数据库问题
13

MySQL SELECT 按组最频繁
MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)...
2024-04-16 数据库问题
16

为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)...
2024-04-16 数据库问题
13

MySQL GROUP BY DateTime +/- 3 秒
MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)...
2024-04-16 数据库问题
14