6

查询和设置 MySQL sql_mode

 2 years ago
source link: https://www.sulinehk.com/post/querying-and-setting-mysql-sql_mode/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

查询和设置 MySQL sql_mode

2021-03-15

因为公司规定需要使用新的内部测试系统,而测试系统的 MySQL 运行在 Docker 里面,并且生产环境的 sql_mode 不是默认值,所以写了这篇博客来记录如何查询和设置 sql_mode。

MySQL Logo

查询 sql_mode

  • SELECT @@sql_mode;
  • SHOW VARIABLES LIKE 'sql_mode';

设置 sql_mode

  • 写入 SQL 查询,数据库链接关闭后失效:SET GLOBAL sql_mode='';
  • 写入 MySQL 配置文件,Docker 重启后失效:echo [mysqld] >> /etc/mysql/my.cnf; echo "sql_mode=''" >> /etc/mysql/my.cnf
  • 写入 Docker 配置文件,Docker 重启后还可以生效:echo "sql_mode=''" >> /etc/mysql/conf.d/docker.cnf

5.1.10 Server SQL Modes

文章作者 sulinehk

上次更新 2021-03-15

许可协议 CC BY-NC-ND 4.0

可重复执行的 MySQL 常用存储过程

satori/go.uuid 非随机 UUID 问题(CVE-2021-3538)的原因和修复


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK