Solve mysql-can't get stat of (errcode: 13)

Source: Internet
Author: User

When importing mysql Data today, the following error occurs:
Mysql> load data infile '/root/aaa' into table test fields terminated by', 'Lines terminated by '\ n ';
Mysql> ERROR 13 (HY000): Can't get stat of '/root/aaa' (Errcode: 13)
At first, I thought it was a problem with the/root/aaa File Permission or the mysql root User permission. Later I thought it was wrong. The mysql root User is a Super User and must have the permission, the problem lies in the permission of the/root/aaa file. Later, the/root/aaa permission is changed to 777. After the operation is executed, it still does not work.
Haha, it turns out that the permission of the file directory where the aaa file is located is good. Switch to/tmp/aaa and perform the above operations:
Mysql> load data infile '/tmp/aaa' into table users_groups fields terminated by', 'Lines terminated by '\ n ';
Query OK, 14 rows affected (0.01 sec)
Records: 14 Deleted: 0 Skipped: 0 Warnings: 0
OK!
The reason for using the/tmp directory is that mysql uses/tmp as the temporary read/write directory by default.
Mysql> show variables like '% tmpdir % ';
+ ----------------- + ------- +
| Variable_name | Value |
+ ----------------- + ------- +
| Slave_load_tmpdir |/tmp |
| Tmpdir |/tmp |
+ ----------------- + ------- +
2 rows in set (0.00 sec)
 
Author: "linux"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.