mysql数据库,查看数据存放目录datadir

需求描述

  在使用数据库,或者刚接手一个数据库时,可以查看该数据库的数据文件存放在什么位置。

操作过程

1.通过查看datadir系统变量来查看数据目录

[mysql@redhat6 mysql-bin]$ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 8
Server version: 5.5.57-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, 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> show variables like 'datadir';
+---------------+--------------+
| Variable_name | Value        |
+---------------+--------------+
| datadir       | /mysql/data/ |
+---------------+--------------+
1 row in set (0.09 sec)

备注:上面的例子中,数据目录就在/mysql/data/目录下。

文档创建时间:2018年4月3日19:32:49

原文地址:https://www.cnblogs.com/chuanzhang053/p/8710644.html