MySQL 在哪里存储数据库文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2091350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:01:20  来源:igfitidea点击:

where does MySQL store database files?

mysqlphpmyadminwamprecover

提问by Ihsanullah khan

I have uninstall wamp server and now I need my database to restore. How can I do this process?

我已经卸载了 wamp 服务器,现在我需要恢复我的数据库。我怎样才能完成这个过程?

回答by Jorge Nunez Newton

In any case you can know it:

在任何情况下,您都可以知道:

mysql> select @@datadir;
+----------------------------------------------------------------+
| @@datadir                                                      |
+----------------------------------------------------------------+
| D:\Documents and Settings\b394382\My Documents\MySQL_5_1\data\ |
+----------------------------------------------------------------+
1 row in set (0.00 sec)

Thanks Barry Galbraith from the MySql Forum http://forums.mysql.com/read.php?10,379153,379167#msg-379167

感谢来自 MySql 论坛的 Barry Galbraith http://forums.mysql.com/read.php?10,379153,379167#msg-379167

回答by Cryophallion

WAMP stores the db data under WAMP\bin\mysql\mysql(version)\data. Where the WAMP folder itself is depends on where you installed it to (on xp, I believe it is directly in the main drive, for example c:\WAMP\...

WAMP 将 db 数据存储在WAMP\bin\mysql\mysql(version)\data. WAMP 文件夹本身的位置取决于您将其安装到的位置(在 xp 上,我相信它直接位于主驱动器中,例如c:\WAMP\...

If you deleted that folder, or if the uninstall deleted that folder, if you did not do a DB backup before the uninstall, you may be out of luck.

如果你删除了那个文件夹,或者如果卸载删除了那个文件夹,如果你在卸载之前没有做数据库备份,你可能就不走运了。

If you did do a backup though phpmyadmin, then login, and click the import tab, and browse to the backup file.

如果您确实通过 phpmyadmin 进行了备份,请登录并单击导入选项卡,然后浏览到备份文件。

回答by Graviton

Check your my.cnffile in your MySQL program directory, look for

检查您my.cnf的 MySQL 程序目录中的文件,查找

[mysqld]
datadir=

The datadiris the location where your MySQL database is stored.

datadir是您的 MySQL 数据库的存储位置。

回答by JerryGoyal

another way from MySQL Workbench:

MySQL Workbench 的另一种方式:

enter image description here

在此处输入图片说明

回答by MarianD

For WampServer, click on its tray icon and then in the popup cascading menu select

对于 WampServer,单击其托盘图标,然后在弹出的级联菜单中选择

MySQL | MySQL settings | datadir

MySQL Data Directory

MySQL 数据目录