Corrupted Database Tables

Operating System & Version
CentOS v7.9.2009
cPanel & WHM Version
cPanel & WHM v102.0.8 (STANDARD)

Skhilled44

Active Member
Jul 15, 2017
28
5
53
Reading, PA, USA
cPanel Access Level
Root Administrator
Hi, lately I've received 3 email with this in the Subject:

"check_mysql has determined that there are corrupted database tables"

The 1st few lines in the email contains:

"cPanel & WHM has determined that the following database tables are corrupt:


DatabaseError
mysql mysqlcheck: [Warning] /root/.mylogin.cnf should be readable/writable only by current user.


We recommend that you repair these tables with WHM’s Repair a MySQL/MariaDB Database interface at: https://xxx.xxxxxxx.com:2087/scripts/repairmysqllist

If the repair fails, contact cPanel Support for further assistance."

How can I fix this? Btw, I'm using CentOS v7.9.2009, if that matters and using MySQL 5.7.
 
Last edited by a moderator:

andrew.n

Well-Known Member
Jun 9, 2020
903
338
63
EU
cPanel Access Level
Root Administrator
ls -l /root/.mylogin.cnf

Whats the output of this command? I believe this should be owned by mysql though I'm not 100% sure.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
11,032
1,740
363
cPanel Access Level
Root Administrator
In most systems, /root/.mylogin.cnf isn't present. If it is, it takes precedence over the default /etc/my.cnf, which looks like this:

Code:
-rw-r--r-- 1 root root 1128 Mar 22 17:08 /etc/my.cnf
Can you check the permissions and ownership on that file as @andrew.n mentioned?
 

Skhilled44

Active Member
Jul 15, 2017
28
5
53
Reading, PA, USA
cPanel Access Level
Root Administrator
Hello, thanks for both replies. Here's the output:

-rw-r--r-- 1 root root 24 Nov 2 2020 /root/.mylogin.cnf

EDIT: Btw, I did search and cPRex is correct. The only file I found was my.cnf.
 
Last edited:

andrew.n

Well-Known Member
Jun 9, 2020
903
338
63
EU
cPanel Access Level
Root Administrator
This should be right. Can you rename this file and re-run the repair?

mv /root/.mylogin.cnf /root/.mylogin.cnf.back
 

Skhilled44

Active Member
Jul 15, 2017
28
5
53
Reading, PA, USA
cPanel Access Level
Root Administrator
I'm not sure what I was doing yesterday but You were right all along! I was very tired from work and just probably not seeing things correctly. My apologies. That files is in the right place.

I've renamed it and repaired the tables and get the following:

ls: cannot access /root/.mylogin.cnf: No such file or directory
 

andrew.n

Well-Known Member
Jun 9, 2020
903
338
63
EU
cPanel Access Level
Root Administrator
Are you on Ubuntu? It's weird that its still looking for that file. Just out of curiosity could you change the ownership there from root to mysql?

chown mysql.mysql /root/.mylogin.cnf

then run the repair again.
 

Skhilled44

Active Member
Jul 15, 2017
28
5
53
Reading, PA, USA
cPanel Access Level
Root Administrator
No on Cent and just got a new server so I can switch to Ubuntu. LOL

Yeah, I started to change ownership before I made my first post but thought I'd ask first, just in case there was something else going on. Now the output is:

-rw-r--r-- 1 mysql mysql 24 Nov 2 2020 /root/.mylogin.cnf

However, I tend to get the emails early morning EST time. I've also been getting excessive resources which I believed were tied to this. I guess I'll have to wait until tomorrow morning to see if things continue or change for the better.
 

andrew.n

Well-Known Member
Jun 9, 2020
903
338
63
EU
cPanel Access Level
Root Administrator
Please do keep us updated. I like CentOS better than Ubuntu. I tag @cPRex here though if he has any feedback on this too.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
11,032
1,740
363
cPanel Access Level
Root Administrator
I'm not totally sure what the issue would be with this one - you're always welcome to submit a ticket to our team so we can check it out.

I recently moved my personal server over to AlmaLinux 8 as I wanted to stay with a CentOS flavor, and it's working well.
 

Skhilled44

Active Member
Jul 15, 2017
28
5
53
Reading, PA, USA
cPanel Access Level
Root Administrator
I thought about AlmaLinux too but with it being so new I just wasn't sure.

However, I am still getting that same email and I am noticing that whenever I repair any database via WHM it says the same thing in the very first line of the output:

mysqlcheck: [Warning] /root/.mylogin.cnf should be readable/writable only by current user.
I'm starting to think there may be ownership or permission issues that I am unaware of.
 

quietFinn

Well-Known Member
Feb 4, 2006
1,659
333
438
Finland
cPanel Access Level
Root Administrator
The error says:
mysqlcheck: [Warning] /root/.mylogin.cnf should be readable/writable only by current user.
so, if I understand right, the rights should be:
-rw-------
not:
-rw-r--r--
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
11,032
1,740
363
cPanel Access Level
Root Administrator
Here is what our team found in that ticket:


"I appreciate your patience while I look into this issue. It seems at some point, the mysql_config_editor program led to the creation of the "/root/.mylogin.cnf" file, which is essentially an encoded .my.cnf file that will take precedence over an existing .my.cnf file if it exists.

[20:53:29 [email protected] ~]cPs# cat /root/.mylogin.cnf

[20:53:42 [email protected] ~]cPs# stat /root/.mylogin.cnf
File: ‘/root/.mylogin.cnf’
Size: 24 Blocks: 8 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 12731 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 27/ mysql) Gid: ( 27/ mysql)
Access: 2022-03-26 20:53:42.098070493 -0400
Modify: 2020-11-02 04:15:48.716250029 -0500
Change: 2022-03-26 20:53:14.599820255 -0400
Birth: -

I went ahead and moved this file to the directory you see in the output below:

[20:59:13 [email protected] ~]cPs# mkdir -vp /root/cptechs/94429335
mkdir: created directory ‘/root/cptechs’
mkdir: created directory ‘/root/cptechs/94429335’
[21:12:27 [email protected] ~]cPs# mv -v /root/.mylogin.cnf /root/cptechs/94429335/
‘/root/.mylogin.cnf’ -> ‘/root/cptechs/94429335/.mylogin.cnf’

I believe this will fix the issue; if you keep receiving emails regarding database corruption, feel free to reach out to us. If you have any other questions or concerns, cPanel support is always here to help. It was my pleasure working on this issue with you, and I hope you are satisfied with the experience."

At this point we haven't seen any additional emails sent from the server.
 

andrew.n

Well-Known Member
Jun 9, 2020
903
338
63
EU
cPanel Access Level
Root Administrator
uhm I advised the OP earlier here to rename the file and he said:

"I've renamed it and repaired the tables and get the following:

ls: cannot access /root/.mylogin.cnf: No such file or directory"

so he got an error back that it doesn't exist.