For example, change mysql data directory from /var/lib/mysql to /var/data/mysql

Step1: Copy the /var/lib/mysql to new name /var/lib/mysqlnew

cp -prvf /var/lib/mysql /var/lib/mysqlnew

sudo vi /etc/mysql/my.cnf 

Looking for:

datadir = /var/lib/mysql

Change to :

datadir  = /var/data/mysql
 

And open file:

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

Looking for:

  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,
 

Change to:

 /var/data/mysql/ r,
  /var/data/mysql/** rwk,

Reload AppArmor profile:

sudo /etc/init.d/apparmor reload

Finally, restart MYSQL:

sudo /etc/init.d/mysql restart

Change MYSQL data directory的更多相关文章

  1. Change the default MySQL data directory with SELinux enabled

    转载:https://rmohan.com/?p=4605 Change the default MySQL data directory with SELinux enabled This is a ...

  2. How To Move a MySQL Data Directory to a New Location on Ubuntu 16.04

    16 How To Move a MySQL Data Directory to a New Location on Ubuntu 16.04 PostedJuly 21, 2016 62.1kvie ...

  3. 启动 mysql 失败 Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql'

    Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' 这应该是某种情况下导致/usr/ ...

  4. Mac下启动MySQL出现错误“the /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user”解决

    错误如下: Warring the /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user 这应该是某 ...

  5. Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql'

    Mac OS X的升级或其他原因可能会导致MySQL启动或开机自动运行时   在MySQL操作面板上会提示“Warning:The /usr/local/mysql/data directory is ...

  6. 启动mysql 失败,“Warning:The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' ”

    一.Mac OS X的升级或其他原因可能会导致MySQL启动或开机自动运行时 在MySQL操作面板上会提示“Warning:The /usr/local/mysql/data directory is ...

  7. MySQL Data Directory -- Creating file-per-table tablespaces outside the data directory

    Creating file-per-table tablespaces outside the data directory 一. Data Directory 1.应对情况 当数据库所在空间不足的时 ...

  8. Warning the user/local/mysql/data directory is not owned by the mysql user

    sudo chown -RL root:mysql /usr/local/mysql sudo chown -RL mysql:mysql /usr/local/mysql/data sudo /us ...

  9. 14.5.5 Creating a File-Per-Table Tablespace Outside the Data Directory

    14.5.5 Creating a File-Per-Table Tablespace Outside the Data Directory 创建一个File-Per-Table Tablespace ...

随机推荐

  1. CSS与JQuery的相关问题

    文字隐藏:p div里面的文字过长时隐藏文字: overflow:hidden; text-overflow:ellipsis; white-space:nowrap; --------------- ...

  2. 【转】Java 项目UML反向工程转化工具

    原文链接:http://www.cnblogs.com/bakari/p/3561207.html 今天在看一个模拟器的源码,一个包里有多个类,一个类里又有多个属性和方法,如果按顺序看下来,不仅不能对 ...

  3. Keepalived+Redis高可用部署

    1   Redis简介及安装 Redis是一个开源,先进的key-value存储,并用于构建高性能,可扩展的Web应用程序的完美解决方案. Redis从它的许多竞争继承来的三个主要特点: Redis数 ...

  4. "此站点已经禁用应用程序"在sharepoint 2013中通过v2013部署app提示该错误

    该错误的原文是:the apps are disabled in this site 可以在yahoo或者bing上搜索这个错误,可以找到解决办法: msdn上也有该错误解决办法,但是如果搜索中文,目 ...

  5. 【原创·总结】影响sql查询性能的因素

     1.表定义 (1)如果字符串字段是经常需要用到的,可以冗余,否则不要冗余 (2)经常需要作为where的查询条件的字段,可以建索引:但是过多的索引会影响写入时的性能 (3)合理定义字段的数据类型 ( ...

  6. 1014mysqldumpslow.pl简单分析慢日志 WINDOW平台

    转自http://www.th7.cn/db/mysql/201507/113998.shtml 要想运行mysqldumpslow.pl(这是perl程序),下载perl编译器.下载地址:http: ...

  7. 一个Activity掌握Design新控件 (转)

    原文地址:http://blog.csdn.net/lavor_zl/article/details/51295364 谷歌在推出Android5.0的同时推出了全新的设计Material Desig ...

  8. [转]Hibernate设置时间戳的默认值和更新时间的自动更新

    原文地址:http://blog.csdn.net/sushengmiyan/article/details/50360451 Generated and default property value ...

  9. Laplacian算子

    多元函数的二阶导数又称为Laplacian算子: \[ \triangledown f(x, y) = \frac {\partial^2 f}{\partial x^2} + \frac {\par ...

  10. UIView的autoresizingMask和autoresizesSubviews属性的剖析

    UIVIew的autoresizingMask和autoresizesSubviews属性的剖析 autoresizingMask是为了iPad开发中横竖屏适配而降生的,他只能约束父子控件之间的关系. ...