简体   繁体   English

服务mysql启动在我的日志文件中留下“特权表:表'mysql.user'不存在”并且服务器失败

[英]service mysql start leaves “privilege tables: Table 'mysql.user' doesn't exist” in my log file and the server fails

I have read through MANY of the other posts that have a similar issue but none seem to be the same issue I am having so I hope someone can help. 我已经阅读了许多其他类似问题的文章,但似乎与我所遇到的问题都不相同,因此希望有人可以提供帮助。

All of the other posts that I have seen, in some degree say to start over with a new install or at least destroy and rebuild the main mysql database where all the users and other references are built. 我看到的所有其他帖子都在某种程度上说是要重新安装,或者至少销毁并重建构建所有用户和其他引用的主要mysql数据库。 I don't want to do that because there is so much data in my current database AND IT STILL WORKS (sort of). 我不想这样做,因为我当前的数据库中有太多数据,而且仍然可以正常工作。

I was having a lot of trouble with apparmor blocking file construction from mysql so I got pissed off and removed apparmor. 我在使用apparmor阻止来自mysql的文件构建时遇到了很多麻烦,所以我很生气并删除了apparmor。 That is when this all started. 这就是一切开始的时候。

Starting MySQL the normal way gives me the error from the subject line in the log file and the server never stops. 以正常方式启动MySQL会给我日志文件中主题行的错误,并且服务器永不停止。 This is the command I normally use 这是我通常使用的命令

service mysql start

On the other hand, if I start mysql this way it works!!! 另一方面,如果我以这种方式启动mysql,则可以正常工作!!!

mysqld --user=mysql --basedir=/var/lib/mysql --datadir=/var/lib/mysql/data

So, now I know there is nothing wrong with MySQL itself nor the databases. 因此,现在我知道MySQL本身或数据库都没有问题。 There must be something wrong causing the normal startup process to not know where the database is suppose to be. 一定有问题导致正常的启动过程不知道数据库应该在哪里。

The problem is, the config files have not changed in any way. 问题是,配置文件没有任何更改。 They get read in just fine because as soon as I do get the database running, everything works fine and all my apps come online and work perfectly. 他们读得很好,因为一旦我确实使数据库运行,一切就可以正常工作,并且我所有的应用程序都可以联机并正常运行。

The config file has the correct data path. 配置文件具有正确的数据路径。

/etc/mysql/mysql.conf.d/mysqld.cnf: datadir = /var/lib/mysql/data

Can anyone think of what could be going on here? 谁能想到这里会发生什么? I am sure removing apparmor is the root cause but reinstalling it didn't help any. 我敢肯定,删除apparmor是根本原因,但重新安装它并没有帮助。 It is disabled right now and the serve is running but only if I start it in the alternative way which is not what I want to do. 现在已将其禁用,并且服务正在运行,但仅当我以其他方式启动它(我不想这样做)时才可以。 I want to get back to starting things the normal/correct way. 我想回到正常/正确的方式开始做事。 The alternative is just a stop-gap to get me up and running for now. 替代方案只是让我暂时起步并运行的权宜之计。

THANKS! 谢谢!

I still don't know exactly WHY this has happened. 我仍然不知道为什么会这样。 I am convinced it has something to do with the removal of apparmor but I can't prove it. 我坚信这与撤除apparmor有关,但我无法证明这一点。 Nor can I understand why it has happened but things are working correctly now. 我也不知道为什么会发生,但现在一切正常。

Between the time things were working and the time things stopped working, the only change to the system that I performed was the removal of apparmor. 在事情开始工作到停止工作之间,我执行的系统的唯一更改是移除了apparmor。

Somehow, the config files in my /etc/mysql/mysql.conf.d folder stopped getting read in. They were being included from the file /etc/mysql/mysql.cnf. 不知何故,我的/etc/mysql/mysql.conf.d文件夹中的配置文件停止被读取。它们被包含在文件/etc/mysql/mysql.cnf中。 The file /etc/mysql/my.cnf only included the files in the in the folder /etc/mysql/conf.d and those were still being included. 文件/etc/mysql/my.cnf仅包含/etc/mysql/conf.d文件夹中的文件,而这些文件仍在被包含。

As root (sudo su) I kept tinkering trying to figure out why things had stopped and one command that was extremely helpful was this... 作为root(sudo su),我一直不停地尝试找出原因为何停止,并且其中一个非常有用的命令是...

mysqld --user=mysql --verbose --help

This showed all the values mysqld was trying to use to start up the service. 这显示了mysqld试图用来启动服务的所有值。 I instantly saw that the datadir value was not what what was in my config file. 我立即看到datadir值不是我的配置文件中的值。 This is why it worked when I ran the command by hand and specified the data dir but failed when I tried to start the service normally. 这就是为什么当我手动运行命令并指定数据目录但在尝试正常启动服务时失败时它起作用的原因。

I have no idea why the file /etc/mysql/mysql.cnf is not being read in any longer. 我不知道为什么不再读取文件/etc/mysql/mysql.cnf。 The permissions look fine. 权限看起来很好。 I even tried copying the content to a new file and nothing. 我什至尝试将内容复制到新文件,什么也没有。 The help command says it is only reading from these files in this order... help命令说它仅按此顺序读取这些文件。

/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

So, because I am tired of messing with it, I copied the include line out of the mysql.cnf file over to the my.cfn file. 因此,由于厌倦了此操作,因此将包含行从mysql.cnf文件复制到了my.cfn文件中。 I really don't care where the folder is included from as long as it works. 我真的不在乎文件夹的位置,只要它可以工作即可。

Now the service starts up perfectly as it should. 现在,该服务可以正常启动。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法打开和锁定权限表:表 'mysql.user' 不存在 - Can't open and lock privilege tables: Table 'mysql.user' doesn't exist Docker中的Bootstraping Percona Xtradb Cluster出现错误:无法打开和锁定特权表:表'mysql.user'不存在 - Bootstraping Percona Xtradb Cluster in Docker gives the error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist 表 'mysql.user' 不存在:错误 - Table 'mysql.user' doesn't exist:ERROR 生成根密码时发生mysql错误,表'mysql.user'不存在' - mysql error at root password generation, Table 'mysql.user' doesn't exist' MariaDB 10.4.10 错误 1146 (42S02):表 'mysql.user' 不存在 - MariaDB 10.4.10 ERROR 1146 (42S02): Table 'mysql.user' doesn't exist Mysql/mariadb“无法打开和锁定权限表:表‘mysql.servers’不存在” - Mysql/mariadb "Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist" mySQL上的mysql.user表 - mysql.user table on mySQL 无法重新启动 MySQL Docker 容器,出现“无法打开 mysql.plugin 表”和“表 'mysql.user' 不存在”等错误 - Cannot restart the MySQL Docker container, gives errors like `Can't open the mysql.plugin table` and `Table 'mysql.user' doesn't exist` 致命错误:无法打开和锁定权限表:表 'mysql.host' 不存在 - Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist Mysql 密码已过期,我的 mysql.user 表已损坏 - Mysql password expired and my mysql.user table is corrupted
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM