我想运行mysqld --skip-grant-tables (重置根密码)。
$ 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 ...然后它马上就会离开。在/var/log/mysql中没有生成任何内容。mysqld还没跑,直到我一分钟前杀了它,它还能正常工作。
编辑:我把这些可疑的线从绞线中拉了出来
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)发生了什么?
发布于 2016-11-17 11:56:08
由于您以root用户的身份运行该命令,因此该命令将中止,请尝试如下:
su - mysql -c 'mysqld --skip-grant-tables --explicit_defaults_for_timestamp=ON'请注意,在/var/log/mysql.log中不会产生任何内容,因为/var/log不能写入mysql用户。查看/var/lib/mysql/YOURHOST.err中的日志记录。
发布于 2019-11-08 14:48:58
strace中的第一行意味着/var/log/mysql不属于mysql,即运行mysqld的用户。
https://serverfault.com/questions/815506
复制相似问题