Change the MySQL Temporary Files Directory

By default, MySQL’s temporary files are stored in the system temporary directory, usually /tmp. In case you wish to change the location of these files, follow these steps:

  1. Edit the my.cnf file in the etc/ subdirectory of your XAMPP installation directory (usually, /opt/lampp). Within this file, find the tmpdir variable in the [mysqld] section and change it to reflect your new desired location. For example:

    tmpdir = "/mnt/sdb2/tmp"
  2. Save your changes to the file.

  3. Restart the MySQL server.

MySQL’s temporary files should now get created in the new location.