MySQL 5.7 关闭严格模式
If your app was written for older versions of MySQL and is not compatible with strict SQL mode in MySQL 5.7, you can disable strict SQL mode. For example, apps such as WHMCS 6 and Craft 2 do not support strict SQL mode.
To disable strict SQL mode, SSH in to your server as root and create this file:
/etc/mysql/conf.d/disable_strict_mode.cnf
Open the file and enter these two lines:
[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Restart MySQL with this command:
sudo service mysql restart
This change disables two SQL mode settings, STRICT_TRANS_TABLES and ONLY_FULL_GROUP_BY, that were added in MySQL 5.7 and cause problems for some older applications.
Confirming Strict SQL Mode Is Disabled
You can confirm strict SQL mode is disabled by running this command as root:
sudo mysql -i -BN -e 'SELECT @@sql_mode' | grep -E 'ONLY_FULL_GROUP_BY|STRICT_TRANS_TABLES'
If strict mode is disabled, you won't see any output from that command.
If disabling strict mode causes any problems for you, you can re-enable it by deleting that file and restarting MySQL again.
What Strict SQL Mode Errors Look Like
If your app isn't compatible with strict SQL mode, you'll often see SQL errors such as:
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of
SELECT list is not in GROUP BY clause and contains nonaggregated column
'yourdbname.tblannouncements.date' which is not functionally dependent on
columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
MySQL 5.7 关闭严格模式的更多相关文章
- MySQL 在线开启&关闭GTID模式
MySQL 在线开启&关闭GTID模式 目录 MySQL 在线开启&关闭GTID模式 基本概述 在线开启GTID 1. 设置GTID校验ENFORCE_GTID_CONSISTENCY ...
- 解决Lost connection to MySQL server during query错误方法/Mysql关闭严格模式
使用Navicat 导入MySQL数据库的时候,出现了一个严重的错误,Lost connection to MySQL server during query,字面意思就是在查询过程中丢失连接到MyS ...
- MySQL主从复制之半同步模式
MySQL主从复制之半同步模式 MySQL半同步介绍: 一般情况下MySQL默认复制模式为异步,何为异步?简单的说就是主服务器上的I/O threads 将binlog写入二进制日志中就返回给客户端一 ...
- 解决ThinkPHP关闭调试模式时报错的问题汇总
解决ThinkPHP关闭调试模式时报错的问题汇总 案例一: 最近用ThinkPHP开发一个项目,本地开发测试完成上传到服务器后,第一次打开正常,再刷新页面时就出现 "页面调试错误,无法找开页 ...
- MySQL服务 - MySQL列类型、SQL模式、数据字典
MySQL列类型的作用: 列类型可以简单理解为用来对用户往列种存储数据时做某种范围"限定",它可以定义数据的有效值(字符.数字等).所能占据的最大存储空间.字符长度(定长或变长). ...
- thinkphp关闭调试模式(APP_DEBUG => false),导致程序出错
thinkphp关闭调试模式(APP_DEBUG => false),导致程序出错,开启调试模式,不报错,怎么解决? 查看Logs日志记录: [ --29T09::+: ] 113.108.11 ...
- mysql启动与关闭(手动与自动)
手动管理mysql的启动与关闭 [root@mysql ~]# service mysql start --手动启动mysqlStarting MySQL. SUCCESS![root@mysql ~ ...
- MySQL 开启与关闭远程访问&&授权前需执行GRANT USAGE ON *.* TO 'cai'@'%' IDENTIFIED BY 'caigan2015';才能终端访问
MySQL 开启与关闭远程访问 (1)通过MySQL用户去限制访问 权限系统目的: MySQL基于安全考虑root账户一般只能本地访问,但是在开发过程中可能需要打开root的远程访问权限,今天介绍的就 ...
- MYSQL复制的几种模式
MySQL 5.1 中,在复制方面的改进就是引进了新的复制技术:基于行的复制. MYSQL复制的几种模式 MySQL 5.1 中,在复制方面的改进就是引进了新的复制技术:基于行的复制.简言之,这种新技 ...
随机推荐
- Python 在 Windows 下安装第三方包,报 Python 未注册的问题解决
保存一些代码为 reg.py,运行之即可. #/usr/bin/env python # -*- coding: utf-8 -*- import sys from _winreg import * ...
- 自动化测试中依据元素实时截图,比较元素图片是否一致(selenium和appium通用)
1.根据元素的上下左右的坐标进行截图 2.先安装pillow 3.下面是截图 4.下面是比较两张图片的值 5.截取两张图片,然后对两张图片比对,这种场景,可以在测试视频播放.图片显示页面做验证.
- Spring Security(十七):5.8 Method Security
From version 2.0 onwards Spring Security has improved support substantially for adding security to y ...
- 模拟祭-比萨-题解O(n)
题目描述 233233 [ 233 ] ( 233 ) KikokKikok 得到了一块比萨,他迫不及待地想与妹妹 Kik子和 koko美一同享用它. 比萨是一种圆形的食物.为了将它分给三个人,Kik ...
- TIME_WAIT过多的解决方法(转)
1.参考:https://blog.csdn.net/liangzhao_jay/article/details/50546898 2.参考: [Unix 网络编程]TCP状态转换图详解 - wenq ...
- SpringBoot热部署的实现方式
一:热部署的实现 1.使用Spring-boot-devtools 2.使用Spring Loaded 二:devtools(推荐) 一般情况下直接在pom.xml文件添加下面的依赖即可,但eclip ...
- Python-Urllib库详解
官方文档地址:https://docs.python.org/3/library/urllib.html 什么是Urllib: Urllib是python内置的HTTP请求库: urllib.requ ...
- Java工具类——UUIDUtils
借用一下百度百科的解释,来看一下UUID是什么. UUID含义是通用唯一识别码 (Universally Unique Identifier),这 是一个软件建构的标准,也是被开源软件基金会 (Ope ...
- MySQL 批量修改某一列的值为另外一个字段的值
mysql> select * from fruit; +----+--------+-------+ | id | name | price | +----+--------+-------+ ...
- PAT L2-020 功夫传人
https://pintia.cn/problem-sets/994805046380707840/problems/994805059118809088 一门武功能否传承久远并被发扬光大,是要看缘分 ...