I've setup a virtual machine on Azure with Ubuntu 16.10 and Mysql 5.7 for a database replication Master/Slave from another server.

I followed this article: https://www.opsdash.com/blog/mysql-replication-howto.html

All seems to works correctly, replication works but I've serious problems with the use of DATA LOAD INFILE. If I use this command, the replication doesn't works.

I tried with relative varible "slave_load_tmpdir", creating a new directory '/var/slavetmp' and updating my.cnf with these values, but this is the error in mysql with "SHOW SLAVE STATUS":

Unable to use slave's temporary directory /var/slavetmp - Can't read dir of '/var/slavetmp/' (Errcode: 13 - Permission denied)

Have any ideas?

Thanks in advance

migrated from stackoverflow.com Mar 7 '17 at 23:51

This question came from our site for professional and enthusiast programmers.

  • please run this - ls -l /var/slavetmp on Slave? think it not have permissions for mysql user – a_vlad Mar 8 '17 at 0:35
  • This is the result: total: 0 – RRJ Mar 8 '17 at 19:26
  • it my mistake - I ask check permission for /var/slavetemp, so need check ls -l /var, so follow next answer from @Jim Parks – a_vlad Mar 8 '17 at 20:35
  • This is after Jim and yours tips: drwxr-xr-x 2 mysql mysql 4096 Mar 7 23:06 slavetmp (I'm replying below to Jim..) – RRJ Mar 9 '17 at 0:49
  • @RRJ, can you post results of: ls -l / – thatsaru Mar 17 '17 at 12:17

Assuming that the MySQL user is called "mysql" (check for "user" in my.cnf):

  1. chown mysql.mysql -R /var/slavetmp

  2. Edit /etc/apparmor.d/usr.sbin.mysqld. Copy the lines for /var/lib/mysql and edit the copied lines to refer to /var/slavetmp

  3. Restart AppArmor: /etc/init.d/apparmor restart

  4. Restart the mysql service

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.