在这里,我提供了一个简单的用户指南,以查找MySQL数据库在Windows和Linux中在哪里将数据存储在我们的硬盘中。
视窗
1)找到my.ini ,该文件存储在MySQL安装文件夹中。
例如,
C:\Program Files\MySQL\MySQL Server 5.1\my.ini
2)用我们喜欢的文本编辑器打开“ my.ini”。
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.1/"
#Path to the database root
datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"
找到“ datadir”,这是MySQL在Windows中存储数据的位置。
的Linux
1)找到与查找/ -name的my.cnf命令my.cnf中 。
yongmo@myserver:~$ find / -name my.cnf
find: /home/lost+found: Permission denied
find: /lost+found: Permission denied
/etc/mysql/my.cnf
2)查看my.cnf文件cat /etc/mysql/my.cnf
yongmo@myserver:~$ cat /etc/mysql/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
3)找到“ datadir”,这是MySQL在Linux系统中存储数据的位置。
标签: MySQL
翻译自: https://mkyong.com/mysql/where-does-mysql-stored-the-data-in-my-harddisk/