报错:
原因:
如果在老版本中运行正常,那么报这个错很有可能是因为新版本中的改动导致的,最可能的原因就是查询语句里面用了关键字。比如这条错误中就包含了新增关键字“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