Bug #37942 Relocated MySQL: "Can't find messagefile '/usr/share/mysql/english/errmsg.sys'."
Submitted: 7 Jul 2008 17:47 Modified: 8 Jul 2008 19:38
Reporter: Phil Wolf Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1.25 OS:Linux (RHEL 4)
Assigned to: CPU Architecture:Any

[7 Jul 2008 17:47] Phil Wolf
Description:
mysqld (5.1.25), installed in a nonstandard location, will not start.  It says, "Can't find messagefile '/usr/share/mysql/english/errmsg.sys'"

This mysqld was installed into a nonstandard location (not /usr) by extracting files from MySQL-*-community-5.1.25-0.rhel4.x86_64.rpm. The aim of varying the installation location was to allow multiple versions of mysqld to run at the same time, serving different databases.

mysqld is being invoked with --no-defaults and --basedir, but the error message cites a location for errmsg.sys that is not relative to basedir.

How to repeat:
1. Verify MySQL is not installed:

$ ls -l /usr/share/mysql
ls: /usr/share/mysql: No such file or directory

2. Unpack MySQL RPMs to an unusual location -- here /opt/MySQL:

$ rpm2cpio MySQL-client-community-5.1.25-0.rhel4.x86_64.rpm | sudo pax -r -s ",^./usr/,/opt/MySQL/,p" -s ",.*,,p"
$ rpm2cpio MySQL-server-community-5.1.25-0.rhel4.x86_64.rpm | sudo pax -r -s ",^./usr/,/opt/MySQL/,p" -s ",.*,,p"
$ rpm2cpio MySQL-shared-community-5.1.25-0.rhel4.x86_64.rpm | sudo pax -r -s ",^./usr/,/opt/MySQL/,p" -s ",.*,,p"
$ rpm2cpio MySQL-devel-community-5.1.25-0.rhel4.x86_64.rpm | sudo pax -r -s ",^./usr/,/opt/MySQL/,p" -s ",.*,,p"

3. Try to run it.

$ /opt/MySQL/sbin/mysqld --no-defaults --socket=/export/home/clindesdb/RUN/peach/mysql/argyle --basedir=/opt/MySQL --port=13306 --datadir=/export/home/clindesdb/RUN/peach/mysql/var
Observe the error:
[ERROR] Can't find messagefile '/usr/share/mysql/english/errmsg.sys' 
mysqld does not start.

4. Hack: 

$ sudo ln -s /opt/MySQL/share/mysql /usr/share/

5. Retry step 3.  mysqld starts.

Suggested fix:
Avoid baking an absolute presumed location for errmsg.sys into mysqld.  Find errmsg.sys relative to basedir.
[8 Jul 2008 19:38] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Please specify language option like: ./sbin/mysqld --no-defaults --basedir=. --datadir=/users/ssmirnova/build/mysql-5.1/data --language=./share/mysql/english/
[27 Nov 2008 15:06] Pete Clapham
Regrettably this is a change in behavior as it also effects binary installs (which it did not pre 5.1) and is undocumented. Hence it is either an intended change in behavior (and therefore a documentation bug) or a bug in the software itself as has been reported.

NB the mysql__install_db is also broken as it now requires 

--no-defaults if installing the binaries in a non std place (even if stating datadir and basedir etc etc).

NB this is also non-documented with the distribution.

Many thanks

Pete
[27 Nov 2008 21:05] Sveta Smirnova
Pete,

if you have my.cnf in some of default places, you have to specify --no-defaults and this is not change in behavior.
[7 Apr 2009 15:54] Thibault Jamme
The reply to this problem from the MySQL Team is disappointing.

The problem described is most likely caused by a glibc upgrade / mismatch.
(Mine got upgraded when I installed VirtualBox - Debian does things behind your back and it's really annoying. ABSOLUTE Rule number one: DON'T DESTROY USER DATA! Anyway.)
The location for the errmsg.sys files must have changed as the folder containing them has a name based on the version of the library or debian has removed a link.

In my case I tried several things before understanding the problem.
I re-ran the install script without success. (But it might have contributed in fixing the problem)

So I found where the error messages where:
find / -name errmsg.sys

So I could make them visible again:

cd /usr/share
ln -s /usr/local/mysql-5.1.32-linux-x86_64-glibc23/share mysql

Then the server complaied again:
[ERROR] Can't start server : Bind on unix socket: No such file or directory
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?

cd /var/run

Sure enough, no mysqld folder there.

mkdir mysqld
chown mysql mysqld

and now a server will start (and while I am logged in as root - why is not complaining??)

These instructions may or may not help you - try to determine why you got the problem in the first place (botched installation? Flimsy upgrade?)
And in any case the message "Can't start server : Bind on unix socket: No such file or directory ... Do you already have another mysqld server running on socket..."
is grossly inacurrate: No, I am not already running something on your precious socket, there's a directory missing. If you'd told me that, it would have been easier.

- Teebo
[13 Apr 2009 14:23] Hugo Garcia
The documentation DOES NOT document the proper instuctions to do a source build and install in a non standard location like /usr/local/mysql (which is the path in the documetation). I had to google the solution in non mysql forum.

In addition the docs dont tell you that you have to do:

mysql_install_db --user=mysql --no-defaults

in order for things to do.
[13 Mar 2013 16:30] Ajyman Johnson
Explicitly tell the location where you want it to be. Notice it's where I installed MySQL.

--lc-messages-dir=/opt/mysql/share/

This is how I start MySQL

./mysql/bin/mysqld --defaults-file=/opt/mysql/my.cnf --datadir=/media/OracleDisk/mysql/data/ --lc-messages-dir=/opt/mysql/share/