MySQL 备份遇到的问题
[root@localhost mc_orderdb]# mysqldump -ubackup -p --master-data=2 --single-transaction --routines --triggers --events --tab="/tmp/mc_orderdb" mc_orderdb
Enter password:
--
-- Position to start replication or point-in-time recovery from
--
-- CHANGE MASTER TO MASTER_LOG_FILE='mysql_bin.000009', MASTER_LOG_POS=1095;
mysqldump: Got error: 1: Can't create/write to file '/tmp/mc_orderdb/order_cart.txt' (Errcode: 13 - Permission denied) when executing 'SELECT INTO OUTFILE'
目前已知是权限问题[root@localhost tmp]# chown mysql:mysql mc_orderdb/
[root@localhost tmp]# ll
drwxr-xr-t. 2 mysql mysql 28 7月 31 21:07 mc_orderdb
再次执行mysqldump -ubackup -p --master-data=2 --single-transaction --routines --triggers --events --tab="/tmp/mc_orderdb" mc_orderdb
还是报错:
[root@localhost mc_orderdb]# mysqldump -ubackup -p --master-data=2 --single-transaction --routines --triggers --events --tab="/tmp/mc_orderdb" mc_orderdb
Enter password:
--
-- Position to start replication or point-in-time recovery from
--
-- CHANGE MASTER TO MASTER_LOG_FILE='mysql_bin.000009', MASTER_LOG_POS=1095;
mysqldump: Got error: 1: Can't create/write to file '/tmp/mc_orderdb/order_cart.txt' (Errcode: 13 - Permission denied) when executing 'SELECT INTO OUTFILE'
刚才搞定了!通过百度找了相关问题,才明白
解决方案:




修改my.cnf
再看
解决之后
这个问题主要是权限和selinux问题,授权+关闭selinux问题即可解决!