zoukankan      html  css  js  c++  java
  • 转载ubuntu下更改mysql data目录

    ubuntu下更改mysql data目录 

    转载,原文出自:http://blog.sina.com.cn/s/blog_6a0b2afd0100qikw.html

    cp /lib/var/mysql /home/caige

    在/etc/mysql/my.cnf 添加:
    [mysqld]
    datadir = /home/caige/mysql


    sudo service mysql start 后无法启动 查看日志 发现
    /usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
    [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
    [ERROR] /usr/sbin/mysqld: Can't create/write to file '/home/caige/mysql/memcache.pid' (Errcode: 13)
    [ERROR] Can't start server: can't create PID file: Permission denied
    很明显权限问题 ubuntu的mysql是有chroot的


    修改/etc/apparmor.d/usr.sbin.mysqld
    /var/lib/mysql/ r, 替换为 /home/caige/mysql/ r,
    /var/lib/mysql/** rwk, 替换为 /home/caige/mysql/** rwk,


    修改/etc/apparmor.d/abstractions/mysql
    /var/lib/mysql/mysql.sock rw, 替换为 /home/caige/mysql/mysql.sock rw,


    sudo /etc/init.d/apparmor restart 重启apparmor
    sudo service mysql start 启动mysql
    成功

  • 相关阅读:
    快速排序算法
    DirectX9(翻译):介绍
    奇葩的面试题
    新博客
    OpenCV2:幼儿园篇 第八章 视频操作
    编程规范:位运算
    编程规范:allocator
    深浅copy和浅copy
    模块和包
    递归函数
  • 原文地址:https://www.cnblogs.com/xby1993/p/3133037.html
Copyright © 2011-2022 走看看