How to change MySQL error message language?

MySQLMySQLi Database

You can use lc_messages to change MySQL error message language. The syntax is as follows −

SET lc_messages = 'yourLanguage';

To understand the concept, let us create a table with some error and check the error message language.

Here, we have set the local message to French. Let us first create a table −

mysql> create table errorMessagelanguage
   -> (
   -> Error_MessageId int,
   -> Error_Message varchar(100),
   -> );

The error message is as follows −

ERROR 1064 (42000): Erreur de syntaxe près de ')' à la ligne 5

Now you can set the error message to be in English language. The query is as follows −

mysql> set lc_messages ='en_US';
Query OK, 0 rows affected (0.00 sec)

Now create a table with some error and check the error message language −

mysql> create table errorMessagelanguage
   -> (
   -> Error_MessageId int,
   -> Error_Message varchar(100),
   -> );

Here is the output −

ERROR 1064 (42000): 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 ')' at line 5
raja
Published on 01-Apr-2019 15:00:02
Advertisements