This morning I attempted to Optimize a large database (3gb+, 10m rows+). My /tmp folder filled as it was only 600mb. Now my table is corrupt and inaccessible until I repair the table.

I've read that I need double the space to successfully repair a table so I need roughly 6-7gb of space.

I've attempted to change the location of MySQL tmpdir by doing the following:

mkdir /home/mysqltmpdir
chmod 1777 /home/mysqltmpdir
chown -R mysql:mysql /home/mysqltmpdir
nano /etc/my.cnf

Then adding the following under [mysqld]


However when I attempt to then restart MySQL I get the following error:

"Unrecognized configuration options may have caused the MySQL startup errors."

I end up needing to removing the line to get MySQL running again. I'm not overly experienced with Linux so I'm unsure how to proceed. I'm currently attempting to pull one of my backups from yesterday in which I can restore the Database, however I would like to firstly repair this one if possible.

  • 1
    always check the mysql error log for clues, you can edit your questions and add my.cnf and error log
    – nbk
    Jun 9, 2021 at 11:00
  • 777 is bad. MySQL hates this level of permissions and will often refuse to start as a result. What is the host operating system? If you’re using Ubuntu, you may also need to update your AppArmor configuration.
    – matigo
    Jun 9, 2021 at 11:57
  • Before considering 777 consider if its systemd service with ProtectHome or selinux. For your error quoted look at mysqld --help --verbose and see which configuration item is the problem. Why do you think you have a corrupt file? Before you attempt to do anything to MySQL files, DON'T, interact via an SQL interface, by the manual documented way, or treat the entire database as a single unit. Anything else will result in data lost. Welcome to DBA exchange. Note 3GB is still small.
    – danblack
    Jun 10, 2021 at 6:35
  • What OS? Is something like Apparmour in effect?
    – Rick James
    Jun 10, 2021 at 20:47


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.