问题
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:
- 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