概述
本文描述了在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