mysqldump: Error: 'Can't create/write to file Can't create temporary files on /var/tmp.

mysqldump: Error: 'Can't create/write to file '/var/tmp/mysql.k6NKGk/#sql_5dc_2.MAI' (Errcode: 2)' when trying to dump tablespaces


On my OS.

 id mysql
uid=60(mysql) gid=105(mysql) groups=105(mysql)

ls -l /var/
drwxrwxrwt  2 root root  72 oct 24 16:43 tmp


What can I do?
Perhaps you can change the owner with

chown -R mysql:mysql /var/tmp


Check to see if there is a [mysqldump] header in /etc/my.cnf. It may look like this:

[mysqldump]
tmpdir=/var/tmp


or perhaps under the [mysqld] header

[mysqldump]
tmpdir=/var/tmp


Try commenting it out and trying mysqldump again.