MySQL Error Code: 1064. You have an error in your SQL syntax

本小妞迷上赌 提交于 2019-12-22 09:16:17

问题


Really, what could possibly be wrong?! It does not get any more simple - the entire query:

line 1: use foo
line 2: 
line 3: select * from test_table_1;

Error Code:

  1. 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 'select * from test_table_1' at line 3 0.002 sec

The line numbers are for reference only - there not actually in the query window.

I'm trying to run this extremely simple query in MySQLWorkbench and it's throwing a syntax error.


回答1:


Try adding a semicolon:

use foo;



回答2:


Without semicolon both statements will treat as single one. By adding semicolon MySQL will treat both statements as multiple queries. Try using

 use foo;
    /*and then*/
    select * from foo;


来源:https://stackoverflow.com/questions/19801489/mysql-error-code-1064-you-have-an-error-in-your-sql-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!