Bug #75343 When running MySQL as a user program (not service) issue with errmsg
Submitted: 30 Dec 2014 20:45 Modified: 13 Jun 2017 17:14
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7.5 labs OS:Linux (SuSE 12.3)
Assigned to: Dyre Tjeldvoll CPU Architecture:Any

[30 Dec 2014 20:45] Peter Laursen
Description:
Simply starting MySQL like this 

peter@linux-hwpu:~/mysql-5.7.5-labs-preview-linux-el6-x86_64/bin> ./mysqld --no-defaults --skip-grant-tables --user=peter --port=3330 --datadir=/home/peter/mysql-5.7.5-labs-preview-linux-el6-x86_64/data

(in order not to conflict with the MariaDB 10.O.15 I have running as a service on the system. I wanted to check this feature http://mysqlserverteam.com/generated-columns-in-mysql-5-7-5/)

How to repeat:
Download mysql-5.7.5-labs-preview-linux-el6-x86_64.tar.gz, 'untar' to user folder. Find a valid 5.7 data folder somewhere (what I did and copied) or generate one. Run command above. Server attempts to start but closes down as errmsg.sys cannot be accessed.

After creating the folder /usr/local/mysql/share/english/ manually (it did not exist, so MariaDB on SuSE does not use it) and copying errmsg.sys from the archive to there and ensure that the file is readable by 'mysql' user the server starts.

Suggested fix:
When not running as a service I expected that it would pick up the file from the /share folder in the (unpacked) arhcive ad not attempt to read from a system folder.

If this is intended I request an option to specify from where to read this. I don't find such here http://dev.mysql.com/doc/refman/5.6/en/server-options.html
[30 Dec 2014 20:45] Peter Laursen
typo fix
[31 Dec 2014 5:02] MySQL Verification Team
Does this work? (note the directory/mysqld_safe).

peter@linux-hwpu:~/mysql-5.7.5-labs-preview-linux-el6-x86_64/> ./bin/mysqld_safe --no-defaults --skip-grant-tables --user=peter --port=3330 --datadir=/home/peter/mysql-5.7.5-labs-preview-linux-el6-x86_64/data
[31 Dec 2014 12:04] Peter Laursen
yes, it worked.

1) 
rename the errmsg.sys that I copied to /usr..... (just in order to be perfectly sure that it is not used)

2)
starting server with mysqld_safe

peter@linux-hwpu:~/mysql-5.7.5-labs-preview-linux-el6-x86_64> ./bin/mysqld_safe --no-defaults --skip-grant-tables --user=peter --port=3330 --datadir=/home/peter/mysql-5.7.5-labs-preview-linux-el6-x86_64/data
141231 12:54:11 mysqld_safe Logging to '/home/peter/mysql-5.7.5-labs-preview-linux-el6-x86_64/data/linux-hwpu.err'.
141231 12:54:11 mysqld_safe Starting mysqld daemon with databases from /home/peter/mysql-5.7.5-labs-preview-linux-el6-x86_64/data

3) 
connecting

peter@linux-hwpu:~/mysql-5.7.5-labs-preview-linux-el6-x86_64/bin> ./mysql --protocol=tcp --port=3330 -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.5-labs-preview 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> 

.. so I should probably have realized that I should start the server with mysqld_safe. But still it is a mystery to me that the server_binary_as_such seems to look in a hardcoded system folder.
[31 Dec 2014 12:11] MySQL Verification Team
To run mysqld by its lonesome as you tried, you have to provide at least the basedir so it knows where to look.

for example:

[z@y bin]$ pwd
/home/z/mysql/release/asan/mysql-5.7.5-m15-linux-i686/bin
[z@y bin]$ ./mysqld --no-defaults --basedir=.. --datadir=../data --console --skip-grant-tables

I personally wish the linux .tar.gz package acted like the windows no-install packages
instead of looking around in /usr/local/mysql/...  for whatever.
[22 Jan 2015 5:07] MySQL Verification Team
Hello Peter,

Thank you for the report.

Thanks,
Umesh
[22 Jan 2015 5:08] MySQL Verification Team
// Downloaded - http://downloads.mysql.com/snapshots/pb/mysql-5.7.5-labs-preview/mysql-5.7.5-labs-preview-...

[root@cluster-repo mysql-5.7.5-labs-preview]# bin/mysql_install_db --no-defaults --basedir=/data/ushastry/server/mysql-5.7.5-labs-preview --datadir=/data/ushastry/server/mysql-5.7.5-labs-preview/data
[root@cluster-repo mysql-5.7.5-labs-preview]# ls -l data/
total 110600
-rw-rw---- 1 root root 12582912 Jan 24 11:55 ibdata1
-rw-rw---- 1 root root 50331648 Jan 24 11:55 ib_logfile0
-rw-rw---- 1 root root 50331648 Jan 24 11:55 ib_logfile1
drwx------ 2 root root     4096 Jan 24 11:55 mysql
drwx------ 2 root root     4096 Jan 24 11:55 performance_schema
[root@cluster-repo mysql-5.7.5-labs-preview]# pwd
/data/ushastry/server/mysql-5.7.5-labs-preview
[root@cluster-repo mysql-5.7.5-labs-preview]# bin/mysqld --no-defaults --skip-grant-tables --user=ushastry --port=3330 --datadir=/data/ushastry/server/mysql-5.7.5-labs-preview/data
2015-01-24T06:38:56.416154Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-01-24T06:38:56.416836Z 0 [Note] bin/mysqld (mysqld 5.7.5-labs-preview) starting as process 7831 ...
2015-01-24T06:38:56.416999Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
..

2015-01-24T06:38:56.540465Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2015-01-24T06:38:56.540531Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2015-01-24T06:38:56.540555Z 0 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions
2015-01-24T06:38:56.741012Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2015-01-24T06:38:56.741034Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-01-24T06:38:56.741329Z 0 [ERROR] Failed to initialize plugins.
2015-01-24T06:38:56.741339Z 0 [ERROR] Aborting

Agree that .tar.gz package should acted like the windows no-install packages instead of looking around in /usr/local/mysql/...  for whatever

Workaround - As Shane pointed out in his previous notes.
[5 Dec 2016 15:31] Paul DuBois
not a docs bug, shouldn't be assigned to me.
[13 Jun 2017 8:00] Ståle Deraas
Posted by developer:
 
Fixed by WL#10441
[13 Jun 2017 17:14] Paul DuBois
Posted by developer:
 
Fixed in 8.0.2.

The server executable determines its own full path name at startup
and uses the parent of the directory in which it is located as the
default basedir value. This in turn enables the server to use that
basedir when searching for server-related information such as the
share directory containing error messages.