Home  >  Q&A  >  body text

MySQL sql_mode设置不生效,为何?

查看sql_mode:

设置sql_mode:

SET sql_mode = 'NO_UNSIGNED_SUBTRACTION,NO_ENGINE_SUBSTITUTION';

再次查看:

退出,重启MySQL,在进入查看设置的又回去了

这是怎么回事?

巴扎黑巴扎黑2743 days ago867

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 14:44:47

    What you set through the client is at the session level. Of course it will be invalid after restarting. If you want to set it at the global level, you need to modify it in the mysql configuration document

    reply
    0
  • 迷茫

    迷茫2017-04-17 14:44:47

    1. SET global sql_mode = 'NO_UNSIGNED_SUBTRACTION,NO_ENGINE_SUBSTITUTION';
    2. Add configuration under [mysqld] of my.cnf: sql_mode = NO_UNSIGNED_SUBTRACTION,NO_ENGINE_SUBSTITUTION

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 14:44:47

    How did you solve it? I also encountered the same problem

    reply
    0
  • Cancelreply