02 May 2014

Trick to shorten MySQL error message

The steps provided here are only for Linux, If you are using some other OS then use respective editor and commands.
MySQL stores error message file at /usr/share/mysql/english/errmsg.sys where english is the language you want to use.
Note:You need to have super user privileges
Step 1. Take backup of existing errmsg.sys (so that you can revert if some problem occured
$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. Search for "You have an" in errmsg.sys
in vi editor for searching try this way-->  /You have an [press enter]
It will get you to the string "You have an error...." as show in screen-shot 

Step 4. Edit that error message as per your need. I've deleted string You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the and kept just right syntax to use
Refer below screen-shot. 

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 mysql service.
$sudo mysql restart
step 7. check error message (I'm checking in phpMyAdmin)

No comments :

Post a Comment

Popular Posts