MySQL Change Data Directory
Stop MySQL using the following command:
sudo /etc/init.d/mysql stopCopy the existing data directory (default located in
/var/lib/mysql) using the following command:sudo cp -R -p /var/lib/mysql /newpathedit the MySQL configuration file with the following command:
sudo gedit /etc/mysql/my.cnf # or perhaps /etc/mysql/mysql.conf.d/mysqld.cnfLook for the entry for
datadir, and change the path (which should be/var/lib/mysql) to the new data directory.In the terminal, enter the command:
sudo gedit /etc/apparmor.d/usr.sbin.mysqldLook for lines beginning with
/var/lib/mysql. Change/var/lib/mysqlin the lines with the new path.Save and close the file.
Restart the AppArmor profiles with the command:
sudo /etc/init.d/apparmor reloadRestart MySQL with the command:
sudo /etc/init.d/mysql restartNow 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
转载于:https://my.oschina.net/geek4j/blog/1535238
MySQL Change Data Directory的更多相关文章
- 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 ...
- MySQL Data Directory -- Creating file-per-table tablespaces outside the data directory
Creating file-per-table tablespaces outside the data directory 一. Data Directory 1.应对情况 当数据库所在空间不足的时 ...
- Change MYSQL data directory
For example, change mysql data directory from /var/lib/mysql to /var/data/mysql Step1: Copy the /var ...
- 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 ...
- 启动 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/ ...
- 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 这应该是某 ...
- MYSQL安装报错 -- 出现Failed to find valid data directory.
运行环境:windows10数据库版本:mysql.8.0.12安装方式:rpm包直接安装 问题描述:mysql初始化的时候找不到对应的数据库存储目录 报错代码: 2018-10-13T03:29:2 ...
- 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 ...
- 安装mysql时出现initialize specified but the data directory has files in in.Aborting.该如何解决
eclipse中写入sql插入语句时,navicat中显示的出现乱码(???). 在修改eclipse工作空间编码.navicate中的数据库编码.mysql中my.ini中的配置之后还是出现乱码. ...
随机推荐
- Linux基础篇,系统服务(service)的管理
一.服务是什么? 用白话文说,服务就是"常驻在内存中的进程",用来提供一些系统或网络功能. 二.service和daemon的区别与联系 因为服务(service)本质上来说也是程 ...
- javascript入门 之 ztree(四 自定义Icon)
<!DOCTYPE html> <HTML> <HEAD> <TITLE> ZTREE DEMO - Standard Data </TITLE& ...
- String与StringBuffer和StringBuilder的根本区别(String为什么无法修改字符串长度)
从网上看了很多的信息,说的大部分是关于final修饰的原因,却没有详细的解释!根据自己收集的资料,跟大家分享一下我的观点(有错请指正).1.我们都知道在修改字符串长度的时候,StringBuffer和 ...
- WEB页面实现方法
页面分类 :添加页.修改页.列表页.详情页.功能页.删除 一.添加 1) 准备tpl.action(添加页.添加页保存公用一个action),并确认是否登录才显示2) 书写添加页action代码,例如 ...
- "选择图片"组件:<pickimage> —— 快应用组件库H-UI
 <import name="pickimage" src="../Common/ui/h-ui/media/c_pickimage"></ ...
- Scala——的并行集合
当出现Kafka单个分区数据量很大,但每个分区的数据量很平均的情况时,我们往往采用下面两种方案增加并行度: l 增加Kafka分区数量 l 对拉取过来的数据执行repartition 但是针对这种 ...
- Sentry实时应用错误跟踪系统在Kubernetes中私有化部署
应用错误跟踪系统:对软件系统运行过程中产生的错误日志进行收集从而实现监控告警. 虽然软件错误❌是不可避免的,但是可以降低错误数. 提高对错误的治理能力能让错误带来的损失降到最低
- 【简单了解系列】从基础的使用来深挖HashMap
HashMap定义 说的专业一点,HashMap是常用的用于存储key-value键值对数据的一个集合,底层是基于对Map的接口实现.每一个键值对又叫Entry,这些Entry分散的存储在一个由数组和 ...
- 数据结构之循环队列Demo
循环队列 比较简单,循环队列主要是判断队满.队空.有效元素个数 画图说明: 假设:队的长度为5(0-4) 但是实际maxsize为6,需要一个预留空间(不存储元素)做计算 继续添加3个元素后: 出队一 ...
- 今天我们来讨论一下display和visibility两个CSS属性。
在讨论着两个属性之前我们先来看看HTML标签的全局属性.就是可以直接在HTML标签上直接写的属性. 以下是菜鸟教程的截图: 1.看以下第一个快捷键的属性accesskey;设置的就不多说了.主要就是2 ...
