Get the App
SLTechnology News&Howtos  ›  Database  › 

ERROR 1 (HY000): Can't create/write to file'/ data

Shulou Source: shulou.com Published: 2022-06-01 13:33:32 10月02日 Update

Non-DBA users are used for load data operations and an error is found.

MariaDB [temp_archive] > select * from T1 into outfile'/ data/test.sql'

ERROR 1 (HY000): Can't create/write to file'/ data/test.sql' (Errcode: 13 "Permission denied")

Prompt to report an error.

Insufficient permission to report error reason.

Analysis:

Permissions have system permissions and database permissions.

/ data directory permissions chown-R mysql:mysql / data/

Lab 1: operating system permissions

Create hy user, use root account operation, file save directory / data/:

Useradd-u 1100 hy

Password hy

Su hy

[hy@XHY005116 /] $mysql

MariaDB [(none)] > use test

Database changed

MariaDB [test] > select * from t111 into outfile'/ data/t111.sql'

Query OK, 1 row affected (0.00 sec)

MariaDB [test] > create table t112 like t111

Query OK, 0 rows affected (0.08 sec)

MariaDB [test] > load data infile'/ data/t111.sql' into table t112

Query OK, 1 row affected (0.02 sec)

Records: 1 Deleted: 0 Skipped: 0 Warnings: 0

File save directory /

MariaDB [test] > select * from t111 into outfile'/ t111.sql'

ERROR 1 (HY000): Can't create/write to file'/ t111.sql' (Errcode: 13 "Permission denied")

Error report: insufficient permissions, it can be analyzed here that the system permissions are insufficient, resulting in error reports.

Lab 2:

Hy users log in to the ya,ya account with read and write permissions, and files are saved in the directory / data/.

MariaDB [test] > select * from t100 into outfile'/ data/t100.sql'

ERROR 1045 (28000): Access denied for user 'ya'@'192.168.%' (using password: YES)

Use files exported by root users and imported by ya users

MariaDB [test] > load data infile'/ data/t100.sql' into table t101

ERROR 1045 (28000): Access denied for user 'ya'@'192.168.%' (using password: YES)

All reported errors: the judgment is a database permission problem.

Attempt to grant file permissions.

MariaDB [(none)] > grant file on *. * to 'ya'@'192.168.%'

MariaDB [(none)] > flush privileges

[hy@XHY005116 data] $mysql-uya-p123456-h292.168.5.116

MariaDB [test] > select * from t101 into outfile'/ data/t101.sql'

MariaDB [test] > load data infile'/ data/t101.sql' into table T102

Query OK, 6 rows affected (0.02 sec)

Success:

File save directory: /

MariaDB [test] > select * from t101 into outfile'/ t101.sql'

ERROR 1 (HY000): Can't create/write to file'/ t101.sql' (Errcode: 13 "Permission denied

Error report: permission problem.

Combination: the previous two experiments show that the "(Errcode: 13" Permission denied "error" is related to the operating system directory.

Permissions of the corresponding mysql

Tags: Permissions directories files users systems labs operating systems data databases accounts problems analysis success two reasons errors attempts prompts related login Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB NVidia Redmi Shulou Information