mysql: [ERROR] 未知变量 ‘sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE’

huangapple go评论75阅读模式
英文:

mysql: [ERROR] unknown variable 'sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE

问题

当我尝试从命令行登录到MySQL时,它给我返回了以下错误消息:mysql: [ERROR] unknown variable 'sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' <username>@<username>-。如何在不登录MySQL的情况下解决这个问题?

英文:

When i tried to login to mySql from command line it gives me mysql: [ERROR] unknown variable &#39;sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION&#39;
&lt;username&gt;@&lt;username&gt;-
error

how should i resolved this with out log into MySQL?

答案1

得分: 6

这个问题可以通过进行以下替换来解决:

sql_mode = '[…]'

替换为

sql-mode = ''

也就是说,在大多数情况下,根据问题中指示的值,移除sql-mode指令的值。

STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

根据MySQL 8.0参考手册 > 5.1.11服务器SQL模式 > 设置SQL模式

英文:

This issue can be solved by making the following substitutions:

sql_mode = &#39;[…]&#39;

to be replaced with

sql-mode = &#39;&#39;

that is to say, by removing
the value of sql-mode directive in most cases as
per the value indicated in the question.

STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

according to MySQL 8.0 Reference Manual > 5.1.11 Server SQL Modes > Setting the SQL Mode

huangapple
  • 本文由 发表于 2020年1月3日 16:51:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575541.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定