Bug #74750 System locale ignored

Submitted: 8 Nov 2014 16:20 Modified: 11 May 2017 10:48
Reporter: Daniël van Eeden Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.7.8, 5.6.23 OS:Any
Assigned to: CPU Architecture:Any
Tags: error messages, l10n, Localization, translations

[8 Nov 2014 16:20] Daniël van Eeden
Description:
The system locale is ignored when running a client utility.

How to repeat:
$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.5-m15 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create table foo(id int, val tinyint default -1);
ERROR 1046 (3D000): No database selected
mysql> select @@lc_messages;
+---------------+
| @@lc_messages |
+---------------+
| en_US         |
+---------------+
1 row in set (0,00 sec)

mysql> \! locale
LANG=nl_NL.utf8
LANGUAGE=nl_NL:nl
LC_CTYPE="nl_NL.utf8"
LC_NUMERIC="nl_NL.utf8"
LC_TIME="nl_NL.utf8"
LC_COLLATE="nl_NL.utf8"
LC_MONETARY="nl_NL.utf8"
LC_MESSAGES="nl_NL.utf8"
LC_PAPER="nl_NL.utf8"
LC_NAME="nl_NL.utf8"
LC_ADDRESS="nl_NL.utf8"
LC_TELEPHONE="nl_NL.utf8"
LC_MEASUREMENT="nl_NL.utf8"
LC_IDENTIFICATION="nl_NL.utf8"
LC_ALL=nl_NL.utf8
mysql> SET lc_messages='nl_NL';
Query OK, 0 rows affected (0,00 sec)

mysql> create table foo(id int, val tinyint default -1);
ERROR 1046 (3D000): Geen database geselecteerd

Suggested fix:
Use the system locale if no locale was set explicitly in the client configuration.
[10 Dec 2014 8:33] MySQL Verification Team
Hello Daniël,

Thank you for the report.
Observed similar case with 5.6.23.

###

[root@cluster-repo mysql-advanced-5.6.23]# LANG=nl_NL.utf8
[root@cluster-repo mysql-advanced-5.6.23]# bin/mysql -u root -p -S /data/ushastry/server/mysql-advanced-5.6.23/run/master.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 524945
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

[(none)]> \! locale
LANG=nl_NL.utf8
LC_CTYPE="nl_NL.utf8"
LC_NUMERIC="nl_NL.utf8"
LC_TIME="nl_NL.utf8"
LC_COLLATE="nl_NL.utf8"
LC_MONETARY="nl_NL.utf8"
LC_MESSAGES="nl_NL.utf8"
LC_PAPER="nl_NL.utf8"
LC_NAME="nl_NL.utf8"
LC_ADDRESS="nl_NL.utf8"
LC_TELEPHONE="nl_NL.utf8"
LC_MEASUREMENT="nl_NL.utf8"
LC_IDENTIFICATION="nl_NL.utf8"
LC_ALL=
[(none)]> select @@lc_messages;
+---------------+
| @@lc_messages |
+---------------+
| en_US         |
+---------------+
1 row in set (0,00 sec)

[(none)]> create table foo(id int, val tinyint default -1);
ERROR 1046 (3D000): No database selected
[(none)]>
[(none)]> SET lc_messages='nl_NL';
Query OK, 0 rows affected (0,00 sec)

[(none)]> create table foo(id int, val tinyint default -1);
ERROR 1046 (3D000): Geen database geselecteerd

Thanks,
Umesh
[11 May 2017 10:48] Daniël van Eeden
Marking Bug #78456 as duplicate

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.062 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.