dtlh12053 2014-12-20 00:57
浏览 236

MySQL sql_mode永久性地关闭严格模式Linux for WHMCS

I'm not super experienced at this but I've been trying to get the mySQL strict_mode setting to be enforced permanently so that I can install and set up the database to install WHMCS.

Problem is I have seen many different posts and people saying you should alter the my.cnf file and put in the following sql_mode setting:

[mysqld]
sql_mode="TRADITIONAL,NO_AUTO_CREATE_USER"

I've also tried just the following:

sql_mode= "TRADITIONAL"

There doesn't seem to be any effect from these. When I restart mySQL and then check the mode using this:

mysql> SELECT @@GLOBAL.sql_mode; 

I get the following which apparently means I'm still in strict mode:

+------------------------------------------------------------------------------------------------------------------------------------------------------+ | @@GLOBAL.sql_mode | +------------------------------------------------------------------------------------------------------------------------------------------------------+ | STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +------------------------------------------------------------------------------------------------------------------------------------------------------+

I can however set the strict mode temporarily off for the session using this:

mysql> SET GLOBAL sql_mode ="";    

The problem is that setting won't hold when the machine is restarted and then it reverts back to strict mode.

Does anyone have some more definitive suggestion on how I can get strict mode permanently off in MySQL on ubuntu to allow me to use WHMCS?

I can't seem to find any other config files that may be overriding this strict mode setting, but I could be missing something that is.

  • 写回答

1条回答 默认 最新

  • drbz99867 2016-09-25 16:12
    关注

    There are two files initially followed by mysql after restarting. You can look for "sql_mode" in these following files and update them as per your requirements: /etc/my.cnf or /usr/my.cnf

    You have to do it as a root user and then it will never change after mysql restart again.

    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算