Changing the tmp folder of mysql

前端 未结 6 993
我寻月下人不归
我寻月下人不归 2021-02-01 15:22

Our Mysql queries use temporary tables which creates temporary files in the process. Currently the files are written to /tmp. How exactly can the path of the temp folder to whic

6条回答
  •  误落风尘
    2021-02-01 16:02

    This maybe helpful for MySql with AppArmor

    stop mysql :

    sudo /etc/init.d/mysql stop
    

    Create directory called /somewhere/tmp

    Edit Config:

    sudo vim /etc/mysql/my.cnf # or perhaps sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

    change

    tmpdir = /somewhere/tmp/

    Then

    sudo vim /etc/apparmor.d/usr.sbin.mysqld
    

    Add

    # Allow data dir access
      /somewhere/ r,
      /somewhere/** rwk,
    

    sudo chown -R root:root /somewhere

    sudo chmod -R 1777 /somewhere

    Restart

     sudo /etc/init.d/apparmor reload
    
     sudo /etc/init.d/mysql restart
    

提交回复
热议问题