How To Export/Import Large Database On MAMP

别等时光非礼了梦想. 提交于 2019-12-04 14:27:07

问题


How do I export/import large database on MAMP ? Using PHPMyAdmin does not work as it supposed to be.


回答1:


It should be done via terminal as below.

  • In the terminal navigate to bin folder of MAMP using below command cd /Applications/MAMP/library/bin
  • Use this command to export the file ./mysqldump -u [USERNAME] -p [DATA_BASENAME] > [PATH_TO_FILE]. EG would be ./mysqldump -u root -p my_database_name > /Applications/MAMP/htdocs/folder_name/exported_db.sql
  • Line should appear saying Enter password:. Here enter the MySQL password. keep in mind that the letters will not appear, but they are there.

If you need to import use BigDump Which is a MySQL Dump Importer.




回答2:


You can also use the Sequel Pro App if you are using MAMP PRO version to get around the defaults that phpMyAdmin gives you.




回答3:


For both operations, open the terminal and type:

EXPORTING:

/Applications/MAMP/library/bin/mysqldump -u [USERNAME] -p [DATABASE_NAME] > [PATH_TO_SQL_FILE]

Then type your password in prompter (default root) and press enter.

Example:

/Applications/MAMP/library/bin/mysqldump -u root -p my_database_name > /Applications/MAMP/htdocs/folder_name/exported_db.sql


IMPORTING:

/Applications/MAMP/library/bin/mysql -u [USERNAME] -p [DATABASE_NAME] < [PATH_TO_SQL_FILE]

Then type your password in prompter (default root) and press enter.

Example:

/Applications/MAMP/library/bin/mysql -u root -p my_database_name < /Applications/MAMP/htdocs/folder_name/exported_db.sql

Important Warning: This will erase your current database!



来源:https://stackoverflow.com/questions/17344428/how-to-export-import-large-database-on-mamp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!