文档章节

MySQL Change Data Directory

Geek-S
 Geek-S
发布于 2017/09/11 16:12
字数 160
阅读 8
收藏 0
  1. Stop MySQL using the following command:

    sudo /etc/init.d/mysql stop
  2. Copy the existing data directory (default located in /var/lib/mysql) using the following command:

    sudo cp -R -p /var/lib/mysql /newpath
  3. edit the MySQL configuration file with the following command:

    sudo gedit /etc/mysql/my.cnf   # or perhaps /etc/mysql/mysql.conf.d/mysqld.cnf
  4. Look for the entry for datadir, and change the path (which should be /var/lib/mysql) to the new data directory.

  5. In the terminal, enter the command:

    sudo gedit /etc/apparmor.d/usr.sbin.mysqld
  6. Look for lines beginning with /var/lib/mysql. Change /var/lib/mysql in the lines with the new path.

  7. Save and close the file.

  8. Restart the AppArmor profiles with the command:

    sudo /etc/init.d/apparmor reload
  9. Restart MySQL with the command:

    sudo /etc/init.d/mysql restart
  10. Now login to MySQL and you can access the same databases you had before.

 

    Reference : https://stackoverflow.com/questions/1795176/how-to-change-mysql-data-directory

© 著作权归作者所有

共有 人打赏支持
Geek-S
粉丝 11
博文 77
码字总数 18976
作品 0
大兴
程序员
mysql 切换 datadir

ubuntu Stop MySQL using the following command: Copy the existing data directory (default located in ) using the following command: edit the MySQL configuration file with the fol......

李三石
2016/06/22
19
0
Install Redmine on Centos 6.5

Install Redmine on Centos 6.5 - 64 bit Install Redmine on Centos 6.5 - 64 bit The System Requirements During the installation process we will use the Centos 6.5 - 64 bit OS, the......

Ericklee
2015/01/22
0
0
MySQL(Replication-MS)

mysql cluster master: .binmysqld --defaults-file=.my.ini create directory: D:/Server/mysql/mysql-master/tmp and D:/Server/mysql/mysql-master/data master-client: .binmysql -h loc......

赵-猛
2016/07/03
11
0
Install Redmine on Centos 6.5 - 64 bit

Install Redmine on Centos 6.5 - 64 bit Install Redmine on Centos 6.5 - 64 bit The System Requirements Update the System Install the dependencies packages Install Apache and MySQ......

xiaoxin
2014/08/25
0
1
定时备份代码和数据库ConteOS

编写脚本 #!/bin/bash name="www" #你代码文件夹的名称 backup_dir="/alidata/$name" #备份路径,看个人喜好,自己命名 time="$(date +"%Y%m%d%H%M%S")" #每天备份时间戳 打开代码所在的目录...

黑鹰客栈
07/03
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

kernel version does not match DSO version

错误信息: kernel version 384.11 does not match DSO version 384.130.0 原因是: cuda driver版本太低,不匹配DSO 简单有效的修复方法,升级nvidia driver, 步骤如下: 1. google seach ...

刘小米
今天
0
0
maven坐标和依赖

一、maven坐标详解 <groupId>com.fgt.club</groupId><artifactId>club-common-service-facade</artifactId><version>3.0.0</version><packaging>jar</packaging> maven的坐标元素说......

老韭菜
今天
1
0
springmvc-servlet.xml配置表功能解释

问:<?xml version="1.0" encoding="UTF-8" ?> 答: xml version="1.0"表示是此xml文件的版本是1.0 encoding="UTF-8"表示此文件的编码方式是UTF-8 问:<!DOCTYPE beans PUBLIC "-//SPRING//......

隐士族隐逸
今天
1
0
基于TP5的微信的公众号获取登录用户信息

之前讲过微信的公众号自动登录的菜单配置,这次记录一下在TP5项目中获取自动登录的用户信息并存到数据库的操作 基本的流程为:微信设置自动登录的菜单—>访问的URL指定的函数里获取用户信息—...

月夜中徘徊
今天
0
0
youTrack

package jetbrains.teamsys.license.runtime; 计算lis package jetbrains.ring.license.reader; 验证lis 安装后先不要生成lis,要把相关文件进行替换 ring-license-checker-1.0.41.jar char......

max佩恩
今天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部