Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=10'

Tags:

mysql

gerrit

I am posting this to save another dev hours of wasted time. Mysql release candidate 5.6.7-rc is junk. As as dev I usually follow as closely as possible with latest version. This caused me hours of debugging gerrit and mysql. The answer is to use a stable version. I hope this helps someone else.

Not sure on the SO protocol for doing something like this - so just posting as a question.

mysql> select VERSION();
+--------------+
| VERSION()    |
+--------------+
| 5.6.7-rc-log |
+--------------+
1 row in set (0.00 sec)

mysql> SET OPTION SQL_SELECT_LIMIT=10;
ERROR 1064 (42000): 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=10' at line 1


mysql>  select VERSION();
+------------+
| VERSION()  |
+------------+
| 5.5.28-log |
+------------+
1 row in set (0.00 sec)

mysql> SET OPTION SQL_SELECT_LIMIT=10;
Query OK, 0 rows affected (0.00 sec)
like image 553
Adrian Cornish Avatar asked Oct 23 '12 04:10

Adrian Cornish


People also ask

How do I select a version of MySQL?

SELECT VERSION Statement It's possible to obtain the version from within the MYSQL client by typing the SELECT VERSION() statement: SELECT VERSION(); This command derives the data from the version variable disregarding other variables.

How do I select top 10 rows in MySQL?

To select first 10 elements from a database using SQL ORDER BY clause with LIMIT 10. Insert some records in the table using insert command. Display all records from the table using select statement.

What is the correct way to connect to a MySQL database?

To connect to the database server, confirm that the MySQL Database Server is running on your machine, right-click the Databases > MySQL Server node in the Services window and choose Connect. You might be prompted to supply a password to connect to the server.


1 Answers

Older versions of MySQL employed SET OPTION, but this syntax is deprecated in favor of SET without OPTION.

SET OPTION syntax is deprecated, and was removed in version 5.6.

You should just use SET SQL_SELECT_LIMIT=10; instead.

Look at the here.

Incompatible Change: The obsolete OPTION modifier for the SET statement has been removed.

like image 98
xdazz Avatar answered Oct 14 '22 01:10

xdazz