Today, when looking at the MySQL user's manual, I saw a very strange problem with the operation of the mysqlimport where the backup was restored.
Copy Code code as follows:
root@zhou:/usr/local/mysql# mysqlimport-uroot-p123-h127.0.0.1-p3306 Test Backup/chen.sql
Mysqlimport:error:13, Can ' t get stat of '/usr/local/mysql/data/backup/chen.sql ' (errcode:2), when using Table:chen
The reason for this error is queried here through Perror:
Copy Code code as follows:
root@zhou:/usr/local/mysql# perror 13
root@zhou:/usr/local/mysql# LL
OS error code 13:permission denied
Copy Code code as follows:
<span style= "font-size:10px" > But here I look at my permission is no problem. My backup files are in the backup document </SPAN>
Copy Code code as follows:
Total Dosage 120
Drwxr-xr-x root mysql 4096 January 10 19:02./
Drwxr-xr-x root 4096 January 8 11:34. /
Drwxr-xr-x 2 mysql mysql 4096 January 17:30 backup/
Drwxr-xr-x 2 root mysql 4096 January 8 10:39 bin/
Copy Code code as follows:
<span style= "font-size:10px" > Here I solve the problem of the way and the process is like this, first Google and Baidu under, see if you can fix such a problem. I then use the load data infile to see if there are any problems (the load command is the same command). </SPAN>
Through Google and Baidu did not find the answer I want, and I was in the load data infile operation, found no problem, so the summary here should not be the issue of permissions:
Copy Code code as follows:
MySQL (root@localhost:test) >load data infile '/usr/local/mysql/backup/chen.sql ' into table Chen;
Query OK, 6 rows affected (0.07 sec)
Records:6 deleted:0 skipped:0 warnings:0
Copy Code code as follows:
<span style= "font-size:10px" > finally through the man query the issue of this command, will find an image is the--local command of the problem </SPAN>
Copy Code code as follows:
root@zhou:/usr/local/mysql# mysqlimport-uroot-p123-h127.0.0.1-p3306 Test Backup/chen.sql
Mysqlimport:error:13, Can ' t get stat of '/usr/local/mysql/data/backup/chen.sql ' (errcode:2), when using Table:chen
root@zhou:/usr/local/mysql# mysqlimport-uroot-p123-h127.0.0.1-p3306 Test Backup/chen.sql--local
Test.chen:records:6 deleted:0 skipped:0 warnings:0
Copy Code code as follows:
<span style= "font-size:10px" > so the problem is solved, here our--local role is </SPAN>
Specifies that the data file be read from the client computer, otherwise read from the server computer
So here's where the problem lies. --local