MySQL数据库在哪里存储其数据? [英] Where does the MySQL database store its data?
问题描述
对于SQLite,该程序直接将数据库信息-模式/数据放入文件中.在命令行提示符下,是
For SQLite, the program directly put the database information - schema/data into a file. In command line prompt, it's
%sqllite3
那么MySQL数据库呢?即使是本地使用,我也需要设置客户端-服务器登录名来访问数据库.无论如何,必须将数据放置在磁盘上的某个位置以占用一些空间.
So How about for MySQL database? Even for a local usage, I need to set up a client-server login to access the database. Anyway, the data has to be put somewhere on the disk to take some space.
更具体地说,如何配置MySQL数据存储位置?如果我需要将MySQL数据移动到另一个目录或磁盘分区,如何进行?
More specifically, how to configure the MySQL data storage location? If I need to move the MySQL data to another directory or disk partition, how to proceed?
推荐答案
更改MySQL安装的 my.cnf
文件中的 datadir
值
Change the datadir
value in my.cnf
file of your MySQL installation
如果您使用的是Windows,则可能会在 C:\ Program Files \ MySQL \ MySQL Server 5.1 \ my.ini
中找到此文件,或者在任何将MySQL安装驱动到的位置
If you are in Windows, probably you will find this file in C:\Program Files\MySQL\MySQL Server 5.1\my.ini
or where ever drive your MySQL installation in
如果您使用的是Linux,则可能会在/etc/mysql/my.cnf
If you are in Linux, probably you will find the file in /etc/mysql/my.cnf
您可以在此处了解更多信息
这篇关于MySQL数据库在哪里存储其数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!