TransWikia.com

mysqld exits immediately with nothing in log, file read failures in strace

Server Fault Asked by spraff on December 6, 2020

I want to run mysqld --skip-grant-tables (to reset the root password).

$ sudo mysqld --skip-grant-tables --explicit_defaults_for_timestamp=ON
2016-11-17 11:27:16 0 [Note] mysqld (mysqld 5.6.31-0ubuntu0.15.10.1) starting as process 5432 ...

Then it exits immediately. Nothing is produced in /var/log/mysql. mysqld is not already running, and until I killed it a minute ago, it was working fine.

EDIT I pulled these suspicious lines out of strace

open("/var/log/mysql/error.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = -1 EACCES (Permission denied)
^---- (error.log doesn't exist and I'm root so wtf?)
...
readlink("./mysql/plugin.MYI", 0x7ffe24c368c0, 511) = -1 EINVAL (Invalid argument)
readlink("./mysql/plugin.MYD", 0x7ffe24c36ac0, 511) = -1 EINVAL (Invalid argument)
access("./mysql/plugin.TRG", F_OK)      = -1 ENOENT (No such file or directory)
open("./ibdata1", O_RDWR|O_CREAT|O_EXCL, 0660) = -1 EEXIST (File exists)
stat("./ib_logfile2", 0x7ffe24c32e70)   = -1 ENOENT (No such file or directory)
stat("./undo001", 0x7ffe24c31e30)       = -1 ENOENT (No such file or directory)
open("./undo001", O_RDWR)               = -1 ENOENT (No such file or directory)
open("./mysql/innodb_index_stats.isl", O_RDWR) = -1 ENOENT (No such file or directory)
...
open("./phpmyadmin/pma__users.isl", O_RDWR) = -1 ENOENT (No such file or directory)
...
stat("/root/.mylogin.cnf", 0x7ffe24c36e50) = -1 EACCES (Permission denied)
unlink("/var/run/mysqld/mysqld.sock")   = -1 ENOENT (No such file or directory)
bind(12, {sa_family=AF_LOCAL, sun_path="/var/run/mysqld/mysqld.sock"}, 110) = -1 ENOENT (No such file or directory)

What happened?

2 Answers

The first line in your strace means that /var/log/mysql is not owned by mysql, that is the user that runs mysqld.

Answered by bbaassssiiee on December 6, 2020

The command aborts because you run it as root, try this:

su - mysql -c 'mysqld --skip-grant-tables --explicit_defaults_for_timestamp=ON'

Note that nothing is produced in /var/log/mysql.log because /var/log is not writable to the mysql user. Look in /var/lib/mysql/YOURHOST.err for logging.

Answered by bbaassssiiee on December 6, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP