Can’t create/write to file’ – How to fix mysqldump error

Can’t create/write to file’ – How to fix mysqldump error

You will get mysqldump error as like below format:

Code:
mysqldump -u root -p databasename> filename.sql Enter password: mysqldump: Error: ‘Can’t create/write to file ‘/var/tmp/#sql_a41_2.MAI’ (Errcode : 2)’ when trying to dump tablespaces mysqldump: Couldn’t execute ‘show fields from activated’: Can’t create/write to file ‘/var/tmp/#sql_a41_0.MAI’ (Errcode: 2) (1)
  • No more space in /tmp:
Files are created in the dump at regular intervals. In case, if you don’t have enough space in /tmp then it triggers the problem in the dump.

To make clearance on the excessive dump files try below-mentioned code:

Code:
$ /etc/init.d/mysqld restart
Try by starting the mysqld with the option –tmpdir. You can even highlight the directory C:\temp using code:

Code:
[mysqld]
tmpdir=C:/temp
Don’t forget that the directory C:/temp should be present already and so, MySQL should have more space for writing.
  • Permission incorrect:
Incorrect configuration or incorrect permission may lead you to have the mysqldump error. Make sure that MySQL directory can write into a directory of tmpdir.

If you use SELinux, check and review the permissions for each file.

Code:
$ cat /etc/my.cnf | grep tmpdir
Code:
$ ls /var/tmp
  • Full of filesystem:
If the storage of the filesystem is filled more then you will get a mysqldump error.

Use perror to check the error code:

Code:
shell> perror 28
OS error code 28: No space left on the device

While a startup, you may get the error. Write protected acted here as a prevention method while indicating directory as well as a file system.

You can ignore the error by testing the error file.

Can't create test file /usr/local/mysql/data/master.lower-test

That’s it! You can make the relevant changes using the codes to go through the short way.
Author
kumkumsharma
Views
7,400
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top