Weird SQL files

Anyone else see these files that start with #sql popup before? I don’t know if they are safe to delete or not…

[root@ncofsc /var/lib/mysql/asteriskcdrdb]$ ls -al
total 3732408
drwx------. 2 mysql mysql        250 Jun  5 19:39 .
drwxr-xr-x. 7 mysql mysql        214 Jan  8  2024 ..
-rw-rw----  1 mysql mysql      13656 Jun  5 19:39 cdr.frm
-rw-rw----  1 mysql mysql  138824536 Oct  2 16:32 cdr.MYD
-rw-rw----  1 mysql mysql   19947520 Oct  2 16:32 cdr.MYI
-rw-rw----  1 mysql mysql       9314 Jun  5 19:39 cel.frm
-rw-rw----. 1 mysql mysql         65 Apr 13  2023 db.opt
-rw-rw----. 1 mysql mysql       8922 Apr 13  2023 queuelog.frm
-rw-rw----  1 mysql mysql       9314 Apr 18  2023 #sql-52e_22bf.frm
-rw-rw----  1 mysql mysql 3449028608 Apr 19  2023 #sql-52e_22bf.MYD
-rw-rw----  1 mysql mysql  219472896 Apr 18  2023 #sql-52e_22bf.MYI
-rw-rw----  1 mysql mysql      13536 Apr 19  2023 #sql-657a_11f.frm
-rw-rw----  1 mysql mysql   13107200 Apr 19  2023 #sql-657a_11f.MYD
-rw-rw----  1 mysql mysql       2048 Apr 19  2023 #sql-657a_11f.MYI

If MySQL crashes in the middle of an ALTER TABLE operation, you may end up with an orphaned temporary table inside the InnoDB tablespace. Using the Table Monitor, you can see listed a table with a name that begins with #sql-. You can perform SQL statements on tables whose name contains the character “#” if you enclose the name within backticks. Thus, you can drop such an orphaned table like any other orphaned table using the method described earlier. To copy or rename a file in the Unix shell, you need to put the file name in double quotation marks if the file name contains “#”.

So some query failed and created the files… You probably don’t want to delete those files but you can go in to mysql and drop the tables which will delete the files

Would mysql actively be using these files in any databases? They are definitely CDRs but I’m not sure if they are old and I don’t need them or if the asteriskcdrdb is actively using them.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.