Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Mint trigger slowly query on mysql on system booting

My debian-based is booting so slow after I installed MySQL and imported some databases on it. Looking for some statement, I found this one during boot:

mysql> show full processlist;
+----+------------------+-----------+------+---------+------+----------------+----------------------------------------------------------------------+
| Id | User             | Host      | db   | Command | Time | State          | Info                                                                 |
+----+------------------+-----------+------+---------+------+----------------+----------------------------------------------------------------------+
|  9 | debian-sys-maint | localhost | NULL | Query   |   12 | Opening tables | select count(*) into @discard from `information_schema`.`PARTITIONS` |
| 10 | root             | localhost | NULL | Query   |    0 | NULL           | show full processlist                                                |
+----+------------------+-----------+------+---------+------+----------------+----------------------------------------------------------------------+
2 rows in set (0.00 sec)

Here the statement that causing trouble:

select count(*) into @discard from `information_schema`.`PARTITIONS`

I have +-10 databases totaling over 8gb of data.

Is there any configuration to disable this query on system booting ? If yes, why run it during boot ?

Information

I have a standard MySQL installation without custom configs.

Best regards.

like image 961
Carlos Spohr Avatar asked Feb 19 '23 01:02

Carlos Spohr


1 Answers

It seems Debian, whose Linux Mint is based upon, have scripts that get executed when the mysql server is started or restarted, to check for corrupted tables and make an alert for that.

In my Debian server, the culprit seems to be /etc/mysql/debian-start bash script, which in turn calls /usr/share/mysql/debian-start.inc.sh , so check both scripts and comment out the function that is iterating all your tables, from a quick look it seems the following:

check_for_crashed_tables;

which is called from the debian-start script I mentioned above.

like image 122
Nelson Avatar answered Mar 05 '23 14:03

Nelson