查询语句在Mysql5上执行正常,在Mysql8中报错ERROR 1064 (42000): You have an error in your SQL syntax;
2021/7/10 19:08:55
本文主要是介绍查询语句在Mysql5上执行正常,在Mysql8中报错ERROR 1064 (42000): You have an error in your SQL syntax;,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
报错:
原因:
如果在老版本中运行正常,那么报这个错很有可能是因为新版本中的改动导致的,最可能的原因就是查询语句里面用了关键字。比如这条错误中就包含了新增关键字“role”.
解决:
将role换掉。
备注:
mysql 新增关键字:
一、MySQL 8.0 新增的关键字和保留字
带®标识的为保留字。
ACTIVE
ADMIN
ARRAY
ATTRIBUTE
BUCKETS
CLONE
COMPONENT
CUME_DIST ®
DEFINITION
DENSE_RANK ®
DESCRIPTION
EMPTY ®
ENFORCED
ENGINE_ATTRIBUTE
EXCEPT ®
EXCLUDE
FAILED_LOGIN_ATTEMPTS
FIRST_VALUE ®
FOLLOWING
GEOMCOLLECTION
GET_MASTER_PUBLIC_KEY
GROUPING ®
GROUPS ®
HISTOGRAM
HISTORY
INACTIVE
INVISIBLE
JSON_TABLE ®
JSON_VALUE
LAG ®
LAST_VALUE ®
LATERAL ®
LEAD ®
LOCKED
MANAGED
MASTER_COMPRESSION_ALGORITH
MSMASTER_PUBLIC_KEY_PATH
MASTER_TLS_CIPHERSUITES
MASTER_ZSTD_COMPRESSION_LEVEL
MEMBER
NESTED
NETWORK_NAMESPACE
NOWAIT
NTH_VALUE ®
NTILE ®
NULLS
OF ®
OFF
OJ
OLD
OPTIONAL
ORDINALITY
ORGANIZATION
OTHERS
OVER ®
PASSWORD_LOCK_TIME
PATH
PERCENT_RANK ®
PERSIST
PERSIST_ONLY
PRECEDING
PRIVILEGE_CHECKS_USER
PROCESS
RANDOM
RANK ®
RECURSIVE ®
REFERENCE
REQUIRE_ROW_FORMAT
RESOURCE
RESPECT
RESTART
RETAIN
RETURNING
REUSE
ROLE
ROW_NUMBER ®
SECONDARY
SECONDARY_ENGINE
SECONDARY_ENGINE_ATTRIBUTE
SECONDARY_LOAD
SECONDARY_UNLOAD
SKIP
SRID
STREAM
SYSTEM ®
THREAD_PRIORITY
TIES
TLS
UNBOUNDED
VCPU
VISIBLE
WINDOW ®
二、MySQL 8.0 移除的关键字和保留字
ANALYSE
DES_KEY_FILE
PARSE_GCOL_EXPR
REDOFILE
SQL_CACHE
这篇关于查询语句在Mysql5上执行正常,在Mysql8中报错ERROR 1064 (42000): You have an error in your SQL syntax;的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-02MySQL 3主集群搭建
- 2024-12-25如何部署MySQL集群资料:新手入门教程
- 2024-12-24MySQL集群部署资料:新手入门教程
- 2024-12-24MySQL集群资料详解:新手入门教程
- 2024-12-24MySQL集群部署入门教程
- 2024-12-24部署MySQL集群学习:新手入门教程
- 2024-12-24部署MySQL集群入门:一步一步搭建指南
- 2024-12-07MySQL读写分离入门:轻松掌握数据库读写分离技术
- 2024-12-07MySQL读写分离入门教程
- 2024-12-07MySQL分库分表入门详解