4

It seems that on a Ubuntu 14.04 machine the user mysql cannot access anything. It is not writing logs nor reading files. Witness:

 - bruno():mysql$ cat /etc/passwd | grep mysql
mysql:x:116:127:MySQL Server,,,:/nonexistent:/bin/false

 - bruno():mysql$ sudo mysql_install_db
Installing MySQL system tables...
140818 18:16:50 [ERROR] Can't read from messagefile '/usr/share/mysql/english/errmsg.sys'
140818 18:16:50 [ERROR] Aborting
140818 18:16:50 [Note] 

Installation of system tables failed!  Examine the logs in
/var/lib/mysql for more information.

...boilerplate trimmed...

 - bruno():mysql$ ls -la /usr/share/mysql/english/errmsg.sys
-rw-r--r-- 1 root root 59535 Jul 29 13:40 /usr/share/mysql/english/errmsg.sys
 - bruno():mysql$ wc -l /usr/share/mysql/english/errmsg.sys
16 /usr/share/mysql/english/errmsg.sys

Here we have seen that mysql cannot read /usr/share/mysql/english/errmsg.sys even though the permissions are open to read it, and in fact the regular login user can read the file (with wc). Additionally, MySQL is not writing any logs:

 - bruno():mysql$ ls -la /var/log/mysql
total 8
drwxr-s---  2 mysql adm    4096 Aug 18 16:10 .
drwxrwxr-x 18 root  syslog 4096 Aug 18 16:10 ..

What might cause this user to not be able to access anything? What can I do about it?

dotancohen
  • 2,590
  • 2
  • 25
  • 39

2 Answers2

1

So, I just had this error after rebooting an old MYSQL server because the file errmsg.sys was deleted.

To fix it you need to have an errmsg.sys file that exactly matches the format expected by MySQL (we used a backup). The error message likely means that some variables cannot be initialized.

MathSRIsh
  • 11
  • 1
1
mysql_install_db --no-defaults --basedir=<your base dir> --datadir=<your data dir> --language=<your language dir such as /usr/share/mysql/english/> --lc-messages-dir=<location>

Please try to run like above and make sure mysql have correct permission on every folders. Hers is reference https://dev.mysql.com/doc/refman/5.7/en/mysql-install-db.html and https://dev.mysql.com/doc/refman/5.7/en/error-message-language.html

asktyagi
  • 2,860
  • 2
  • 8
  • 25
  • Funny thing is, five years on and this answer is still helpful. I was just in a similar situation a few months ago. **Thank you.** – dotancohen May 19 '19 at 13:19