Home  >  Article  >  Database  >  How to change MySQL error message language?

How to change MySQL error message language?

PHPz
PHPzforward
2023-09-08 13:49:10696browse

How to change MySQL error message language?

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

SET lc_messages = 'yourLanguage';

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

Here we 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 English. The query is as follows -

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

Now create a table with 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

The above is the detailed content of How to change MySQL error message language?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete