Bug #90364 Can't find error-message file
Submitted: 10 Apr 2018 8:39 Modified: 25 Oct 2018 8:34
Reporter: David David Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:5.7.21 OS:Windows (Win7 x64)
Assigned to: CPU Architecture:x86
Tags: Can't find error-message file, lc-messages-dir

[10 Apr 2018 8:39] David David
Description:
Part of "mysqld" section of my.ini file:
lc-messages-dir=E:\TestStorage\bin\Debug\mysql\share\english

Error message found in .err file when MySQL service installed on Windows system: 

-----------------------------------------
2018-04-10T07:15:16.173559Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-10T07:15:16.174559Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-04-10T07:15:16.174559Z 0 [Note] MySQL (mysqld 5.7.21) starting as process 3736 ...
2018-04-10T07:15:16.174559Z 0 [ERROR] Can't find error-message file 'E:\TestStoragein\Debug\mysql\share\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2018-04-10T07:15:16.185559Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2018-04-10T07:15:16.185559Z 0 [Note] InnoDB: Uses event mutexes
-----------------------------------------

When I change "lc-messages-dir" value to the following line, start service again and no error happened.
lc-messages-dir=E:/TestStorage/bin/Debug/mysql/share/english

-----------------------------------------
2018-04-10T07:16:56.936322Z 0 [Note] MySQL (mysqld 5.7.21) starting as process 9100 ...
2018-04-10T07:16:56.937322Z 0 [Warning] Using pre 5.5 semantics to load error messages from E:\TestStorage\bin\Debug\mysql\share\english\.
2018-04-10T07:16:56.937322Z 0 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2018-04-10T07:16:56.957323Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
-----------------------------------------

I guess this must be need do some escape in the value of "lc-messages-dir".
And I found other users report this issue before, but this bug never fixed until now.

Same bug submitted by some other user:
https://bugs.mysql.com/bug.php?id=68878
https://bugs.mysql.com/bug.php?id=68856

How to repeat:
Install mysql server to path contain special escape string(e.g. "\n" for "D:\net","\s" for "D:\storage") on windows system.
[11 Apr 2018 5:44] Chiranjeevi Battula
Hello David,

Thank you for the bug report.
I could not repeat the issues with MySQL 5.7.21 version installing on (\n,\s)  paths.
Please try with lc-messages-dir="E:\TestStorage\bin\Debug\mysql\share\english".

Thanks,
Chiranjeevi.
[11 Apr 2018 6:12] David David
MySQL Directory Structure

Attachment: MySql-dir-structure-2018-04-11_140354.png (image/png, text), 9.74 KiB.

[11 Apr 2018 6:15] David David
my.ini configuration(Notice the "dataDir" string contains "\s" part in it)

Attachment: my.ini-cfg-2018-04-11_140527.png (image/png, text), 89.88 KiB.

[11 Apr 2018 6:15] David David
my.ini configuration(Notice the "dataDir" string contains "\s" part in it)

Attachment: my.ini-cfg-2018-04-11_140527.png (image/png, text), 89.88 KiB.

[11 Apr 2018 7:01] David David
The issue of "escape string literally in path" also lies in other corner of mysql. Here I will show you another example.

Environment configuration shows in the former attached files("MySql Directory", "my.ini configuration"). Sorry for the duplicated "my.ini configuration" attachment(I cann't remove the duplicated ones).

The command prompt window show error message as follows, when I run the "mysqld --initialize-insecure" command to build initial data.
--------------------------------------------------------
E:\TestStorage\bin\Debug\mysql\bin>mysqld --initialize-insecure
mysqld: Can't create/write to file 'E:\TestStoragin\Debug\mysql\dbData\is_writab
le' (Errcode: 2 - No such file or directory)
2018-04-11T06:09:07.978274Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
 deprecated. Please use --explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2018-04-11T06:09:07.978274Z 0 [ERROR] Can't find error-message file 'E:\TestStor
agin\Debug\mysql hare\english\errmsg.sys'. Check error-message file location and
 'lc-messages-dir' configuration directive.
2018-04-11T06:09:07.982274Z 0 [ERROR] --initialize specified but the data direct
ory exists and is not writable. Aborting.
2018-04-11T06:09:07.983274Z 0 [ERROR] Aborting
--------------------------------------------------------

Notice the error message of the following line of above:
"
mysqld: Can't create/write to file 'E:\TestStoragin\Debug\mysql\dbData\is_writab
le' (Errcode: 2 - No such file or directory)
"

Part of the Path string shows "E:\TestStoragin\Debug". In fact, the configured part in "my.ini" is "E:\TestStorag\bin\Debug"!!! Maybe mysqld parse the "\b" part in path as Non-printable characters. e.g. "\b" escape as BACKSPACE(0x08 in ASCII) in C language. 

When I change "datadir" in my.ini to "E:\TestStorage\dbData", and run the "mysqld --initialize-insecure" command, everything is OK.
--------------------------------------------------------
E:\TestStorage\bin\Debug\mysql\bin>mysqld --initialize-insecure

E:\TestStorage\bin\Debug\mysql\bin>
------------------------------------------------------

Continue.
Run the "mysqld install" command to install mysql service into system. The message shows in "E:\TestStorage\dbData\WWZ-PC.err" as follows:
-------------------------------------------------------
2018-04-11T06:29:13.263212Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-11T06:29:13.263212Z 0 [ERROR] Can't find error-message file 'E:\TestStoragein\Debug\mysql hare\english\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2018-04-11T06:29:15.618347Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-04-11T06:29:16.326387Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-04-11T06:29:16.549400Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a89fc807-3d51-11e8-8d0a-c89cdc2cc456.
2018-04-11T06:29:16.570401Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-11T06:29:16.575402Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
------------------------------------------------------

Notice the "'E:\TestStoragein\Debug" part which shows above, it shows confused char "" in it. I guess mysql parse the path string of "lc-messages-dir" error!

-1.- DOUBLE QUOTES test

Then I change the "lc-messages-dir" line in my.ini as follows(change it with double quotes in path):

lc-messages-dir="E:\TestStorage\bin\Debug\mysql\share\english"

Remove files in "E:\TestStorage\dbData" and  re-run the "mysqld --initialize-insecure" command, The message shows in "E:\TestStorage\dbData\WWZ-PC.err" as follows:
-----------------------------------------
2018-04-11T06:45:25.549824Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-11T06:45:25.550824Z 0 [ERROR] Can't find error-message file 'E:\TestStoragein\Debug\mysql hare\english\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2018-04-11T06:45:27.664945Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-04-11T06:45:28.153973Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-04-11T06:45:28.341983Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ebdb9747-3d53-11e8-a998-c89cdc2cc456.
2018-04-11T06:45:28.386986Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-11T06:45:28.390986Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
----------------------------------------------

Error happened as before! It seems that double quotes in path has no effect.

-2.- REPLACE '\' WITH '\\' test

Then I change the "lc-messages-dir" line in my.ini as follows(replace '\' with '\\' in path):

lc-messages-dir=E:\\TestStorage\\bin\\Debug\\mysql\\share\\english

Remove files in "E:\TestStorage\dbData" and  re-run the "mysqld --initialize-insecure" command, The message shows in "E:\TestStorage\dbData\WWZ-PC.err" as follows:
-----------------------------------------
2018-04-11T06:52:13.375150Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-11T06:52:13.375150Z 0 [Warning] Using pre 5.5 semantics to load error messages from E:\TestStorage\bin\Debug\mysql\share\english\.
2018-04-11T06:52:13.375150Z 0 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2018-04-11T06:52:15.340262Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-04-11T06:52:15.835291Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-04-11T06:52:15.927296Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: decc53db-3d54-11e8-b1db-c89cdc2cc456.
2018-04-11T06:52:15.979299Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-11T06:52:15.982299Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
----------------------------------------

It just show 'Warning' no error. 

-3.- REPLACE '\' WITH '/' test

The result is same as "-2.- REPLACE '\' WITH '\\' test".
[11 Apr 2018 9:04] David David
Although MySQL work on multiple platform, its early versions may be not build for Windows system mainly. 
Windows uses backslash("\") while others uses forward-slash("/") as directory separator. 
And C/C++ language use backslash for non-printable characters escaping(e.g. "\b","\n","\s").
MySQL is written in C and C++.

So I guess MySQL process the backslash and forward-slash of file path string in config file not very well.

----------------------------
References:
1. Why Windows Uses Backslashes and Everything Else Uses Forward Slashes:
https://www.howtogeek.com/181774/why-windows-uses-backslashes-and-everything-else-uses-for...

2. Term "MySQL" in Wiki:
https://en.wikipedia.org/wiki/MySQL
[11 Apr 2018 9:40] Chiranjeevi Battula
Hello David,

Thank you for your feedback.
Verified as described on MySQL for Windows Installer with 5.7.21 version.

Thanks,
Chiranjeevi.
[11 Apr 2018 9:41] Chiranjeevi Battula
D:\storage\net\bin>mysqld --initialize-insecure
2018-04-11T09:20:00.310447Z 0 [Warning] option 'read_buffer_size': unsigned value 0 adjusted to 8192
2018-04-11T09:20:00.310447Z 0 [Warning] option 'read_rnd_buffer_size': unsigned value 0 adjusted to 1
2018-04-11T09:20:00.310447Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp
2018-04-11T09:20:00.310447Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with s
2018-04-11T09:20:00.326047Z 0 [ERROR] Can't find error-message file 'D: torage
et hare\english\errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2018-04-11T09:20:00.326047Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2018-04-11T09:20:00.326047Z 0 [ERROR] Aborting
[25 Oct 2018 8:34] Erlend Dahl
Posted by developer - Jens Even Blomsoy

This is not a bug.
See documentation: https://dev.mysql.com/doc/refman/8.0/en/option-files.html

The error you see is due to escaping characters.

From the documentation "You can use the escape sequences \b, \t, \n, \r, \\,
and \s in option values to represent the backspace, tab, newline, carriage
return, backslash, and space characters. In option files, these escaping
rules apply:"

This can not be changed at this point. But having escaping characters in
option files does seem to be a mistake...

Having folders with escaping characters on Windows can be avoided by using
"\\".

lc-messages-dir=E:\\TestStorage\\bin\\Debug\\mysql\\share\\english

From the documentation in regards to Windows paths:
"The escaping rules for option file values are especially pertinent for
Windows path names, which use \ as a path name separator. A separator in a
Windows path name must be written as \\ if it is followed by an escape
sequence character."