MySQL: is it possible to shorten error messages?

I heard that many people complain about it, and it is justified. Many MySQL error messages are ridiculously long:

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... 

This becomes especially annoying in environments that show only the first half of this line. So the question is: is it possible to get a shorter version of this line? Something like: Syntax error near... is really the juicy part of this post.

+7
php mysql mysql-error-1064 syntax-error
source share
1 answer

Note. The steps given here are for Linux only, you can use a different OS and then use the appropriate editor and commands

MySQL stores the error message file in /usr/share/mysql/english/errmsg.sys , where english is the language you want to use.

Note. You must have superuser privileges

Step 1. Make a backup of your existing errmsg.sys (so you can come back if there is any problem

  $sudo cp /usr/share/mysql/english/errmsg.sys ~/errmsg.sys.bkp 

Step 2. Open /usr/share/mysql/english/errmsg.sys in vi editor.

 $sudo vi /usr/share/mysql/english/errmsg.sys 

Step 3. Find "You Have" in the errmsg.sys file

 in vi editor for searching try this way--> /You have an [press enter] 

This will lead you to the line "You have an error ..." as shown on the screen. enter image description here

Step 4. Edit this error message to suit your needs. I deleted the line You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the and saved only right syntax to use

Check out the screenshot. enter image description here

Step 5. Save and exit.

 in vi editor to save and exit--> :x! [press enter] here ! is added to override read-only file 

Step 6. Restart the mysql service.

 $sudo mysql restart 

step 7. check the error message (I check phpMyAdmin)

enter image description here

In this answer, I updated the error message 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... 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... , you can also update another standard error message.

Hope this helps !: D

+21
source share

All Articles