Reputation:
MySQL only gives an unhelpful error message when it encounters a grammar or syntax error:
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 .......
Is there any way to let MySQL to explain syntax error (e.g. expecting closing parenthesis, illegal expression, etc) in details?
Upvotes: 16
Views: 2316
Reputation: 121932
The answer is - no. All server errors messages and their codes are listed in the documentation.
Server Error Codes and Messages.
From the documentation - For error checking, use error codes, not error messages. Error messages do not change often, but it is possible.
About the syntax errors: if there are no more specific error codes, then you get Error: 1149 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax...
As a work around: You can view all syntax errors in dbForge Studio for MySQL. Create new SQL document and write some code, or just open SQL-file, automatic SQL syntax check will highlight errors in the code.
Automatic SQL syntax check feature.
This feature is available in Professional and Enterprise editions, but you can try it on trial version.
Upvotes: 5