您现在的位置是:首页 > 文章详情

Mysql异常'SET OPTION SQL_SELECT_LIMIT=DEFAULT'

日期:2018-07-22点击:603

在用hive时遇到这样的一个异常,因为hive的元数据是存储在mysql数据库中,所以对于hive表的操作相应的会操作数据库中表的数据,该问题发生于删除表的时候,创建的时候并未产生该异常。经过查阅资料了解到mysql通过jdbc链接的时候会进行测试'SET OPTION SQL_SELECT_LIMIT=DEFAULT',但是5.6以后的版本弃用了set的方式。

异常信息

NestedThrowablesStackTrace: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=DEFAULT' at line 1 

异常分析

我用的数据库版本是5.7但是用的驱动版本是5.1.8的,现在5.7的数据库中支持的set语句为:
https://dev.mysql.com/doc/refman/5.7/en/set-statement.html

The SET statement has several forms: SET var_name = value enables you to assign values to variables that affect the operation of the server or clients. See Section 14.7.4.1, “SET Syntax for Variable Assignment”. SET CHARACTER SET and SET NAMES assign values to character set and collation variables associated with the current connection to the server. See Section 14.7.4.2, “SET CHARACTER SET Syntax”, and Section 14.7.4.3, “SET NAMES Syntax”. SET PASSWORD assigns account passwords. See Section 14.7.1.7, “SET PASSWORD Syntax”. SET TRANSACTION ISOLATION LEVEL sets the isolation level for transaction processing. See Section 14.3.6, “SET TRANSACTION Syntax”.

set option SQL_SELECT_LIMIT.....已经过时。并且在5.6之后该语法就已经被删除了。

5.6相关的set指令
https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_sql_select_limit

然而用的驱动版本较低的情况下,还是使用以前的set指令导致出错。

解决

将驱动版本升级,尽量驱动版本和数据库版本对应,这个问题切换为5.1.22以上即可。

附StackOverflow
http://stackoverflow.com/questions/15669270/option-sql-select-limit-default

原文链接:https://yq.aliyun.com/articles/617483
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章