简体   繁体   English

如何使用Windows访问硬盘驱动器上的MySQL文件

[英]How to access my MySQL files on a hard drive using Windows

I was given some research data on a hard drive. 在硬盘上给了我一些研究数据。 All the files are in one folder and consists of .frm files, .MYD files, .MYI files, .TRG files and .TRG files. 所有文件都位于一个文件夹中,并由.frm文件,.MYD文件,.MYI文件,.TRG文件和.TRG文件组成。

I downloaded and installed MAMP so that I can run an MySQL Server. 我下载并安装了MAMP,以便可以运行MySQL Server。 I launched PHPMYAdmin in a browser and chose the import option. 我在浏览器中启动了PHPMYAdmin,并选择了导入选项。 I then navigated to the data folder and realized that it was looking for a .zip file with the structure .sql.zip. 然后,我导航到数据文件夹,并意识到它正在寻找具有.sql.zip结构的.zip文件。 I then proceeded to zip all of the content to comply and according to the WinZip dialog box, it was going to take 3 hours! 然后,我继续压缩所有内容以使其符合要求,并且根据WinZip对话框,这将需要3个小时! This cannot be the correct action. 这不是正确的操作。

I found this solution from 8 years ago (derobert): Recover Database Files From MYD MYI FRM Files which has a linux solution (copy the files into the /var/lib/mysql/dbname directory) 我从8年前就找到了该解决方案(Derobert): 具有Linux解决方案的MYD MYI FRM文件中恢复数据库文件 (将文件复制到/ var / lib / mysql / dbname目录中)

There was also a solution for Windows in which a single .frm file and a ibdata1 file is copied to the data folder (alnel). 对于Windows,还有一个解决方案,其中将单个.frm文件和ibdata1文件复制到数据文件夹(alnel)。 Since my intention was not to copy the data to my notebook but, instead, read it directly from the drive, I tried another solution mentioned and it turned into a nightmare.... 由于我的意图不是将数据复制到笔记本中,而是直接从驱动器中读取数据,因此我尝试了所提到的另一种解决方案,这变成了一场噩梦。

I created a symbolic link in the data folder: c:\\MAMP\\bin\\mysql\\data called mydata 我在数据文件夹中创建了一个符号链接:c:\\ MAMP \\ bin \\ mysql \\ data称为mydata

c:\mklink /D mydata e:\MyResearchData

This created a link as expected. 这创建了预期的链接。 I then reloaded PHPMyAdmin expecting to see it listed. 然后,我重新加载了PHPMyAdmin,希望看到它被列出。 I did not. 我没有。 Recognizing that the /D switch is for a soft link, I tried a hard link using /H. 认识到/ D开关用于软链接,我尝试使用/ H进行硬链接。 However, that didn't over-write the previous link. 但是,这并没有覆盖先前的链接。 I then proceeded to delete the link and it deleted all of my data! 然后,我继续删除链接,它删除了我的所有数据! Recovery was not as simple as if I had deleted the data from the C:\\ as it was not in the Recycle Bin. 恢复并不像我从C:\\中删除数据那样简单,因为它不在回收站中。 I was able to use file recovery software but now I am gun-shy about trying anything unproven. 我能够使用文件恢复软件,但是现在我对尝试任何未经证实的事情都持保守态度。

I did eventually copy all the files into the MySQL data folder (suggested by Vishal)(c:\\MAMP\\bin\\mysql\\data\\MyResearchData) and refreshed PHPMyAdmin ... no luck. 最终,我确实将所有文件复制到MySQL数据文件夹(由Vishal建议)(c:\\ MAMP \\ bin \\ mysql \\ data \\ MyResearchData)并刷新了PHPMyAdmin ...运气不好。

I'm hoping someone can lead me in the correct direction. 我希望有人可以指引我正确的方向。

Thank you in advance! 先感谢您!

You've figured out one possible way. 您已经找到了一种可能的方法。 The other way is to find My.ini (mysql config file) in which you will find datadir and basedir like 另一种方法是找到My.ini(mysql配置文件),在其中您将找到datadir和basedir

# Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.7/"

# Path to the database root
datadir=C:/ProgramData/MySQL/MySQL Server 5.7/Data

change the datadir to whatever location you have your MySQL data and restart your server. datadir更改为您拥有MySQL数据的任何位置,然后重新启动服务器。 Since your current data dir is "c:\\mamp\\db\\mysql" look for that line in the config file. 由于您当前的数据目录为"c:\\mamp\\db\\mysql" ,因此请在配置文件中查找该行。

if you are going to use it often, i'd suggest installing MySQL server, workbench and mysql notifier using mysql installer for windows. 如果您打算经常使用它,我建议您使用Windows的mysql安装程序安装MySQL服务器,工作台和mysql通知程序。 It's much more easier to manage. 它更容易管理。 With workbench you can do many things. 使用工作台,您可以做很多事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何用完整的硬盘修复MySQL服务器? - How to fix a MySQL server with a full hard drive? 如何从存储在备份硬盘驱动器上的Windows 7 MySQL数据库中获取数据库? - How can I get a database out of a Windows 7 MySQL Database stored on a backup hard drive? 如何在损坏的硬盘上恢复/恢复我的 MySQL 数据库的数据(记录)? - How to recover/restore the data (records) of my MySQL database on a corrupted hard drive? MySQL 表在外置硬盘上 - MySQL tables on external hard drive 如何使用python脚本从树莓派访问Windows桌面上wamp服务器中的外部mysql数据库? - How to access external mysql database in wamp server on my windows desktop from my raspberry pi using python script? 如何将 MySQL 数据库从一个硬盘驱动器移动到另一个硬盘驱动器? - How do I move a MySQL database from one hard drive to another? 重新定位到外部硬盘RPi后,MySQL将无法启动 - MySQL will not start after relocating to external hard drive RPi MySQL:是否在更新/删除时从硬盘安全删除了列数据? - MySQL: is column data safely deleted from hard drive on update/delete? 在MySQL,MyISAM中,是否可以将带有分区的表更改为多个硬盘驱动器? - In MySQL, MyISAM, Is it possible to alter table with partition into multiple hard drive? 旧硬盘系统的mysql datadir无法启动 - mysql datadir from old hard drive system does not boot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM