0

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?

  • Which OS/Distro ? – user9517 Nov 17 '16 at 11:53
  • Ubuntu 15.10.... – spraff Nov 17 '16 at 12:01
0

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.

| improve this answer | |
  • Thanks but no. Running your command produces no output at all, even the starting as process 1234 line I had before. – spraff Nov 17 '16 at 12:02
  • You might have a mysqld already running? – bbaassssiiee Nov 17 '16 at 12:07
  • It's not already running. – spraff Nov 17 '16 at 13:06
  • @spraff You're probably getting no output because the mysql user has no shell assigned. You can specify a shell as an su option, as shown here: serverfault.com/a/351048 – Jollymorphic May 25 '17 at 22:37
0

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.