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中的配置之后还是出现乱码. ...
随机推荐
- Java多线程并发工具类-信号量Semaphore对象讲解
Java多线程并发工具类-Semaphore对象讲解 通过前面的学习,我们已经知道了Java多线程并发场景中使用比较多的两个工具类:做加法的CycliBarrier对象以及做减法的CountDownL ...
- java接口自动化(三) - 手工接口测试到自动化框架设计之鸟枪换炮
1.简介 上一篇宏哥介绍完了接口用例设计,那么这一章节,宏哥就趁热打铁介绍一下,接口测试工具.然后小伙伴们或者童鞋们就可以用接口测试工具按照设计好的测试用例开始执行用例进行接口手动测试了.关于手动测试 ...
- VXLAN 基础教程:VXLAN 协议原理介绍
VXLAN(Virtual eXtensible Local Area Network,虚拟可扩展局域网),是一种虚拟化隧道通信技术.它是一种 Overlay(覆盖网络)技术,通过三层的网络来搭建虚拟 ...
- Fastdfs文件系统扩容
1.简介 FastDFS文件服务器在设计时,为了支持大容量,存储节点(服务器)采用了分卷(或分组)的组织方式.存储系统由一个或多个卷组成,卷与卷之间的文件是相互独立的,所有卷的文件容量累加就是 ...
- IDEA使用技巧,如何在JSP中创建Servlet“小程序”
步骤 1.新建一个java类,实现Servlet接口 2.实现接口中的抽象方法: 3.在web.xml文件中配置好servlet <web-app ......> <servlet& ...
- 彻底理解Java对象与引用
本文是最近在复习Java的时候读到的来自iteye博客的一篇文章,个人觉得写的很好,但貌似楼主许久没有维护该博客,害怕将来想回顾的时候找不到此文章,故在此重写文章,并修改了一些排版,有助于以后的学习查 ...
- spring-cloud feign的多参数传递方案
查看原文 一.GET请求多参数URL 1.方法一(推荐) @FeignClient(“microservice-provider-user”) public interface UserFeignCl ...
- DataAnalysis-SOP
一.关于数据分析 a. 互联网最热职位:研发工程师.产品经理.人力资源.市场营销.运营.数据分析(供不应求) b. 数据分析的步骤:明确目的/思路.数据收集.数据处理.数据分析.数据展现 c. 数据分 ...
- 31.3 自定义异常类 MyException
/* * 异常的分类: 运行时期异常:RuntimeException的子类就是运行时期异常,在编译时期可以自由选择处理或者不处理 编译时期异常:是Exception的子类,非RuntimeExcpe ...
- JS 浏览器BOM-->简介和属性
1.简介: BOM:浏览器对象模型(Browser Object Model),是一个用于访问浏览器和计算机屏幕的对象集合.我们可以通过全局对象window来访问这些对象. 2.属性 window. ...
