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. 怎样关闭google的自动更新

    谷歌的自动更新很烦人的,只要你点击关于Google Chrome,谷歌就会自动更新成最新版本. 但是sencha框架好像与谷歌29.0以上的兼容性不是很好,所以关闭谷歌自动更新的需求来了,网上很多人说 ...

  2. [BZOJ1016][JSOI2008]最小生成树计数(结论题)

    题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1016 分析: 首先有个性质:如果边集E.E'都可以表示一个图G的最小生成树(当然E和E ...

  3. 使用axes函数在matlab绘图中实现图中图的绘制

    使用axes函数在matlab绘图中实现图中图的绘制 有时为了对细节进行详细说明,需要在一个较大坐标轴上绘制一个小图来对局部进行放大以阐述结果. 这可以通过调用axes函数实现. 下面通过绘制 y=1 ...

  4. CSS与JQuery的相关问题

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

  5. MVC 中的 ispostback

    总之呢就是在MVC中试下 ispostback那种效果, 环境就是:登录验证loinger, if (Request.HttpMethod == "POST"){} 没理解透彻 源 ...

  6. SpringMVC自定义视图 Excel视图和PDF视图

    一.自定义视图-Excel视图 1.Maven依赖 引入POI <dependency> <groupId>org.apache.poi</groupId> < ...

  7. git 查看生成对象

    1. find .   查看目录中所有对象 2. find .git/objects 查看所有对象 3. git cat-file -p 散列值  输出文件内容

  8. Java设计模式(三) 装饰模式

    装饰模式:动态的将责任附加到对象上,想要扩展功能,装饰者提供有别于继承的另一种选择. 1,创建顶级类 package com.pattern.decorate; public abstract cla ...

  9. Using the rJava package on Win7 64 bit with R

    加载 rJava 包报错: > library(rJava) Error : loadNamespace()里算'rJava'时.onLoad失败了,详细内容: 调用: fun(libname, ...

  10. iOS的网络环境判断

    网络环境的判断有两种方式 1.Reachability 2.AFNetWorking中 AFNetworkReachabilityManager Reachability步骤 (1)导入Reachab ...