MySQL: Difference between revisions

From Han Wiki
Jump to navigation Jump to search
→‎mysqldump returning Errcode 13: update source to syntaxhighlight
Line 4: Line 4:
When I try to create a CSV file from a table in the database I'd get an Errcode 13. Here I'm trying to extract a table called <span class="package">enc_codes3</span> from a database called <span class="package">testdb</span>
When I try to create a CSV file from a table in the database I'd get an Errcode 13. Here I'm trying to extract a table called <span class="package">enc_codes3</span> from a database called <span class="package">testdb</span>


<source lang="bash" highlight="1">
<syntaxhighlight lang="bash" highlight="1">
mhan@dbserver:~$ mysqldump --tab=./testdump -uroot -p --fields-terminated-by=, --fields-enclosed-by='"' --lines-terminated-by=0x0d0a -t testdb enc_codes3
mhan@dbserver:~$ mysqldump --tab=./testdump -uroot -p --fields-terminated-by=, --fields-enclosed-by='"' --lines-terminated-by=0x0d0a -t testdb enc_codes3
Enter password:
Enter password:
mysqldump: Got error: 1: Can't create/write to file '/home/mhan/testdump/enc_codes3.txt' (Errcode: 13) when executing 'SELECT INTO OUTFILE'
mysqldump: Got error: 1: Can't create/write to file '/home/mhan/testdump/enc_codes3.txt' (Errcode: 13) when executing 'SELECT INTO OUTFILE'
</source>
</syntaxhighlight>


Make sure that the mysql daemon (mysql:mysql on Ubuntu) is able to write to the folder.
Make sure that the mysql daemon (mysql:mysql on Ubuntu) is able to write to the folder.

Revision as of 10:48, 28 June 2016

mysqldump returning Errcode 13

  • Last tested on Ubuntu 14.04.2 LTS (trusty)

When I try to create a CSV file from a table in the database I'd get an Errcode 13. Here I'm trying to extract a table called enc_codes3 from a database called testdb

mhan@dbserver:~$ mysqldump --tab=./testdump -uroot -p --fields-terminated-by=, --fields-enclosed-by='"' --lines-terminated-by=0x0d0a -t testdb enc_codes3
Enter password:
mysqldump: Got error: 1: Can't create/write to file '/home/mhan/testdump/enc_codes3.txt' (Errcode: 13) when executing 'SELECT INTO OUTFILE'

Make sure that the mysql daemon (mysql:mysql on Ubuntu) is able to write to the folder.

apparmor status can be checked via sudo aa-status.

Disable apparmor temporary ( service apparmor teardown ) execute the above command and then restart it again ( service apparmor start ).