Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

export large database mysql phpmyadmin

I am using phpmyadmin on my windows os. I have a database with one table which has 100M records with the size of 20GB. I want to export this table and have the table.sql file. Whenever I try to do this, the size of the exported file is 0 bytes. When I check the apache error log, the following would show up:

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1066139648 bytes)

Any idea how to solve this problem?!

Thanks :)

like image 309
ahajib Avatar asked Nov 17 '13 08:11

ahajib


5 Answers

I would suggest to try using the command line and the mysqldump.exe utility, as suggested here

like image 130
user2196728 Avatar answered Oct 02 '22 06:10

user2196728


If you have shared hosting and you are using Cpanel then they are providing you the option to backup your database in the following section.

Files => Backup => Download a MySQL Database Backup.

like image 27
Indrasinh Bihola Avatar answered Oct 02 '22 06:10

Indrasinh Bihola


If you are on a shared hosting or you don't have access to shell, then use mysqldumper script; copy it to your server and start it in your browser under "yourDomain.com/path_to_mysqlumper/"

MySQLDumper is a PHP and Perl based tool for backing up MySQL databases. You can easily dump your data into a backup file and - if needed - restore it. It is especially suited for shared hosting webspaces, where you don't have shell access.

MySQLDumper is a PHP and Perl based tool for backing up MySQL databases. You can easily dump your data into a backup file and - if needed - restore it. It is especially suited for shared hosting webspaces, where you don't have shell access.

If you have shell access to your host servers (if provided by your host since not all shared server hosters give this access) then you may use SSH access like in this tutorial using Putty that you install and configure then import or export your databases like in this third tutorial.

like image 36
numediaweb Avatar answered Oct 02 '22 06:10

numediaweb


I try mysqldump for many hours but didnt work, until I started a superuser console.

First, start a superuser console

sudo su

Then, try the complete command

/opt/lampp/bin/mysqldump -u root -p [DATABASE NAME] > [PATH_FOR_BACKUPFILE]/[FILE_NAME].sql

I my case, it was something like /opt/lampp/bin/mysqldump -u root -p database > /home/user/backup.sql

like image 31
Ezequiel Pavon Avatar answered Oct 02 '22 06:10

Ezequiel Pavon


MySQLDumper worked like a charm for me at my hosted website. I had to copy one database and "paste" it into a new database. In MySQLDumper, it isn't apparent right away how to do this, but the key is to create a new configuration file in MySQLDumper and that will allow you to copy/restore to different databases.

On the home screen in MySQLDumper, click Configuration, then Configuration Files. There is a text box at the top allowing you to create a new Configuration file. In there, put in the information for the second database you need (you created a connection to the first database when you install MySQLDumper). Save it. Then you can click Restore where you can select the dump of the first database and restore it in the second one.

This was a lifesaver. Thanks!

like image 34
tom Avatar answered Oct 02 '22 06:10

tom