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