简体   繁体   中英

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. 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. 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. This is the command I normally use

service mysql start

On the other hand, if I start mysql this way it works!!!

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. 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. 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. 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.

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. 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.

As root (sudo su) I kept tinkering trying to figure out why things had stopped and one command that was extremely helpful was this...

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

This showed all the values mysqld was trying to use to start up the service. I instantly saw that the datadir value was not what what was in my config file. 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. 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...

/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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM