一、背景
原数据库数据目录:/data/mysql3306/data,日志文件目录:/data/mysql3306/binlog
变更后数据库目录:/mysqldata/3306/data,日志文件目录:/mysqldata/3306/binlog
二、操作过程
1、创建测试数据,并停止原库
[root@node02 data]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.18 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database testdb;
Query OK, 1 row affected (0.08 sec)
mysql> use testdb;
Database changed
mysql