LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Folder "mysql" is full (https://www.linuxquestions.org/questions/linux-newbie-8/folder-mysql-is-full-4175607488/)

Nimenno 06-07-2017 04:29 PM

Folder "mysql" is full
 
Hi there, we are running a server based on centOS with mariadb.

Now folder /var/lib/mysql where MySQL are stored is getting full, because one file/folder is getting bigger and bigger. I don't know whats the purpose of this file/folder.

Do you have any experience to share with me or ideas, how I can delete this file/folder? Should I delete this or its essential?

Command: du /var/lib/mysql/0 -h

Extract:

Code:

8.3G        /var/lib/mysql/0
This "0" I dont know what it is...

Thanks for support!

Habitual 06-07-2017 06:49 PM

Looks to be a database at that location
Code:

mysql -u root -p -e "show databases like '%0%';" -Ns

Ztcoracat 06-07-2017 10:34 PM

No I wouldn't delete it until you have confirmation that you can.
The third link talks about it.

https://www.digitalocean.com/communi...on-on-centos-7

https://www.quora.com/How-can-I-safe...-var-lib-mysql

https://forums.cpanel.net/threads/co...-files.130597/

Nimenno 06-08-2017 04:31 AM

I deleted those files/folders
- /var/lib/mysql/0
- /var/lib/mysql/1:

1. sudo systemctl stop mariadb
2. rm 0
3. rm 1
4. sudo systemctl start mariadb

Websites still running. No issues.

What I don't get with your sources: Why was there this huge folders? What are this?

Ztcoracat 06-08-2017 05:14 PM

Not sure why the huge folder.

It's most likely a default to keep a data base.

MySQL data base files are stored in the same place on a Debian system/server too.
https://unix.stackexchange.com/quest...ases-on-debian

Four answers here that give a little more of an explanation.
https://stackoverflow.com/questions/...sql-store-data

HTH

Habitual 06-08-2017 05:54 PM

Quote:

Originally Posted by Nimenno (Post 5720406)
I deleted those files/folders
What I don't get with your sources: Why was there this huge folders? What are this?

They were databases. How they got there is anybody's guess.
Grok around /var/log/, check .mysql_history files on the system.
If that's the way you verify databases, I hope you have tested backups.

And why ask why, if you don't care to follow direction?

sundialsvcs 06-08-2017 07:13 PM

I hope that you are using LVM = Logical Volume Management to manage your physical drive space. If so, you can simply add another hard drive to your physical storage pool, then assign all or part of it to the logical storage pool where your "mysql" folder is located. Even without restarting your machine, you have just increased the amount of space available.

And if you don't use LVM now, I strongly suggest that you convert to it at once. :tisk:

TheShadowKnows 04-20-2018 11:05 AM

Explanation and solution
 
Hi,

I had a similar issue and I investigated thoroughly.

My monitoring toolkit told me to inspect that virtual machine for high disk usage, when I wasn't expecting it... After searching through the file system, I noticed a file named /var/lib/mysql/1 having a size of about 40 GB...

After some checkups, I noticed the file was opened by the main MySQL thread, so I suspected it was maybe a log... I checked some parts of the file and this confirmed my intuition...

After some investigation, I noticed there was an entry "log_slow_queries=1" into the MySQL configuration... I tested changing the parameter to the value "0" and it created a log with that name in the /var/lib/mysql folder...

According to the documentation, the log_slow_queries parameter isn't a boolean... If it is defined, it uses the name as is... If it's a 0 or a 1, it will create the log with that name.

So I expect you have an entry "log_slow_queries=0" in your MySQL configuration.


All times are GMT -5. The time now is 05:28 AM.