概述
本文描述了在Ubuntu 16.04系统下修改mysql-server-5.7数据库datadir目录的详细步骤。目标:将数据库目录datadir从/var/lib/mysql修改到/home/database/mysql。
系统信息:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
$ uname -a
Linux Ubuntu 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
mysql-server版本:
Server version: 5.7.11-0ubuntu6 (Ubuntu)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
步骤
以下步骤需要停止mysql服务并假设用户拥有管理员权限。
一、停止mysql服务
sudo service mysql stop

本文详述了如何在Ubuntu系统中将MySQL数据库的datadir目录从旧位置迁移到新位置,涉及停服、备份、新建目录、移动数据、修改配置文件、更新apparmor配置及重启服务等步骤。确保在操作前对数据进行备份,成功迁移后通过验证确认服务正常运行。
最低0.47元/天 解锁文章
631

被折叠的 条评论
为什么被折叠?



