1000mb database file is not uploading completely - mysql

We have a Magento site.
We have a large database of 1000MB for that site.
When we try to import database through phpmyadmin, it's not uploading the full database. Lot of tables are missing after uploading.
Qe are getting this error :
Script timeout passed, if you want to finish import, please resubmit
same file and import will resume
We have a GoDaddy cpanel and phpmyadmin.
Is there any way to upload a large database completely?
I am planning to change php.ini settings as mentioned in this question:
How to solve time out in phpmyadmin?
But I could not able to find php.ini file.
Have I need to edit the default Magento phi.ini.sample?

use sqlsplitter, It will created small chunk of you large sql file and then upload all these small files

Try like this in your Godaddy SSH,
Log on to your server.
At the command line, type su -. This gives you root access.
At the command line, type mysql -uroot -p
Enter your MySQL root password.
Select yourdatabase name for insert data by writing this command, USE YOURDATABASENAME
Then load source sql file as SOURCE D:\profile20\database.sql
Press enter for insert data.
This video link may help you.

Related

How to migrate 10GB old table to new table? [duplicate]

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 :)
I would suggest to try using the command line and the mysqldump.exe utility, as suggested here
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.
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.
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.
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
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!
increase
max_post_size
variable in php.ini file. Then you will be able to download it.
I had a different issue when I was downloading from phpmyadmin in the middle like 180MB download stops with message - network error
So I used ssh connection which you can find in your cpanel sometimes they provide browser based terminal or sometime you have to access it using putty .
In terminal I go inside my public_html folder where all my files are stored . Followed by this command:
mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql]
This did the job in few minutes and saved a sql file in my public_html folder. Then I opened the folder in File manager and downloaded it from there.
You can also use FTP or you can download it directory by accessing by url.
Make sure you delete it after your download finishes.

export mysql database schema and data using phpmyadmin

I'm trying to export a database with phpmyadmin but the result is a file that can't be read. In phpmyadmin I leave the options and only add compression. After downloading I'm unable to open the resulted .sql file (after extracting) in geany and get a complaint about the file being in an encoding that's not supported. Every time I do the export the file seems to be of a random size as if the process just stops somewhere.
It's a small database with joomla stuff that needs to be moved to another site and I would like to use mysldump but don't have ssh access. Other than the phpmyadmin in the cpanel I can't think of another way to access that data but phpmyadmin doesn't seem to be up for doing the job.
Is there any setting I should have to have a look at or some other way to get that data exported?
Try disabling compression or using another compression method. There have been a few bugs in phpMyAdmin. Maybe you are stumbling about one of them. Also try opening the sql file in an ordinary text editor and check the content maybe you can get some more information about the problem you are experiencing.
If you have access to the commandline you can also try the following command: mysqldump -u <username> -p <database_name> > dumpfilename.sql.

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 :)
I would suggest to try using the command line and the mysqldump.exe utility, as suggested here
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.
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.
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.
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
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!
increase
max_post_size
variable in php.ini file. Then you will be able to download it.
I had a different issue when I was downloading from phpmyadmin in the middle like 180MB download stops with message - network error
So I used ssh connection which you can find in your cpanel sometimes they provide browser based terminal or sometime you have to access it using putty .
In terminal I go inside my public_html folder where all my files are stored . Followed by this command:
mysqldump -u [username] -p [database-you-want-to-dump] > [path-to-place-data-dump.sql]
This did the job in few minutes and saved a sql file in my public_html folder. Then I opened the folder in File manager and downloaded it from there.
You can also use FTP or you can download it directory by accessing by url.
Make sure you delete it after your download finishes.

How to Import 1GB .sql file to WAMP/phpmyadmin

I want to import over 1GB size sql file to MySQL database in localhost WAMP/phpmyadmin. But phpmyadmin UI doesn't allow to import such big file.
What are the possible ways to do that such as any SQL query to import .sql file ?
Thanks
I suspect you will be able to import 1 GB file through phpmyadmin But you can try by increasing the following value in php.ini and restart the wamp.
post_max_size=1280M
upload_max_filesize=1280M
max_execution_time = 300 //increase time as per your server requirement.
You can also try below command from command prompt, your path may be different as per your MySQL installation.
C:\wamp\bin\mysql\mysql5.5.24\bin\mysql.exe -u root -p db_name < C:\some_path\your_sql_file.sql
You should increase the max_allowed_packet of mysql in my.ini to avoid MySQL server gone away error, something like this
max_allowed_packet = 100M
Step 1:
Find the config.inc.php file located in the phpmyadmin directory. In my case it is located here:
C:\wamp\apps\phpmyadmin3.4.5\config.inc.php
Note: phymyadmin3.4.5 folder name is different in different version of wamp
Step 2:
Find the line with $cfg['UploadDir'] on it and update it to:
$cfg['UploadDir'] = 'upload';
Step 3:
Create a directory called ‘upload’ within the phpmyadmin directory.
C:\wamp\apps\phpmyadmin3.2.0.1\upload\
Step 4:
Copy and paste the large sql file into upload directory which you want importing to phymyadmin
Step 5:
Select sql file from drop down list from phymyadmin to import.
The values indicated by Ram Sharma might need to be changed in Wamp alias configuration files instead.
In <wamp_dir>/alias/phpmyadmin.conf, in the <Directory> section:
php_admin_value upload_max_filesize 1280M
php_admin_value post_max_size 1280M
php_admin_value max_execution_time 1800
Make sure to check the phpMyAdmin config file as well! On newer WAMP applications it is set to 128Mb by default. Even if you update php.ini to desired values you still need to update the phpmyadmin.conf!
Sample path: C:\wamp64\alias\phpmyadmin.conf
Or edit through your WAMP icon by: ->Apache -> Alias directories -> phpMyAdmin
I also faced the same problem and, strangely enough, changing the values in php.ini did not work for me.
But I found out one more solution that worked for me.
Click your Wamp server icon -> MySQL -> MySQL console
Once MySQL console is open. Enter your MySQL password and enter these commands:
use user_database_name
source path/to/your/sql/path/filename.sql
If you still have problems, watch this video.
What are the possible ways to do that such as any SQL query to import .sql file ?
Try this
mysql -u<user> -p<password> <database name> < /path/to/dump.sql
assuming dump.sql is your 1 GB dump file
A phpMyAdmin feature called UploadDir permits to upload your file via another mechanism, then importing it from the server's file system. See http://docs.phpmyadmin.net/en/latest/faq.html#i-cannot-upload-big-dump-files-memory-http-or-timeout-problems.
If you will try to load such a large file through phpmyadmin then you would need to change upload_file_size in php.ini to your requirements and then after uploading you will have to revert it back. What will happen? If you would like to load a 3GB file. You will have to change those parameters in php.ini again.
The best solution to solve this issue to open command prompt in windows.
Find path of wamp mysql directory.
Usually, it is C:/wamp64/bin/mysql/mysqlversion/bin/mysql.exe
Execute mysql -u root
You will be in mysql command prompt
Switch database with use command.
mysql> use database_name
mysql> source [file_path]
In case of Windows, here is the example.
mysql> source C:/sqls/sql1GB.sql
That's it. If you will have a database over 10GB or 1000GB. This method will still work for you.
Before importing just make sure you have max_allowed_pack value set some thing large else you will get an error: Error 2006 MySQL server gone away.
Then try the command: mysql -u root -p database_name < file.sql
You can do it in following ways;
You can go to control panel/cpanel and add host %
It means now the database server can be accessed from your local machine.
Now you can install and use MySQL Administrator or Navicat to import and export database with out using PHP-Myadmin, I used it several times to upload 200 MB to 500 MB of data with no issues
Use gzip, bzip2 compressions for exporting and importing. I am using PEA ZIP software (free) in Windows. Try to avoid Winrar and Winzip
Use MySQL Splitter that splits up the sql file into several parts. In my personal suggestion, Not recommended
Using PHP INI setting (dynamically change the max upload and max execution time) as already mentioned by other friends is fruitful but not always.
I suggest you'd definitely use mysql command prompt that would be faster option. because there are limitation in phpmyadmin UI and browsers itself for process request
following are steps to use mysql command line.
doesnt matter if you user xampp/wamp/mamp
find mysql directory in xampp/wamp/mamp in your system directory
search for bin folder path is system dir/(xampp/wamp)/mysql/bin
now open command prompt i'll refer to windows
please change directory in command line and point to path_to_mysql_bin
then user following command
"mysql-u root -p -h localhost" press enter system will ask for password press enter again
finally you're in
please use command "use Database_name" to point to specific database and you're good to go
if you want to upload database in to for ex. temp table
then follow these steps
use temp;
source path_to_sql_file_where_db_is_store_in_your_system.sql;
this will upload sql file database in temp db
if you didnt get any part from this then please pm me i'll definitely help you out.
Mitesh
In Your Case with Xammp it not work.
To Slove this problem In Xammp?
Just make database to Zip file and upload that's
it will work in xammp.
if the size is too large it will show you time out error
but submit the same zip folder again and after resubmitting will continue from position when it Force stop.
I've tried with the SQLyog and It has done the work.
Go to c:/wamp/apps/phpadmin3.5.2
Make a new subfolder called ‘upload’
Edit config.inc.php to find and update this line: $cfg[‘UploadDir’] = ‘upload’
Now when you import a database, you will give a drop-down list in web server upload directory with all the files in this directory. Chose the file you want and you are done.

Import a large database - CPanel & MySQL & PHPMyAdmin

I have a database which has the size over 100 MB. It has the .sql.gz which means it is compressed. When I try to import it using PHPMyAdmin I get time out errors. I even tried partial imports ( Allow the interruption of an import in case the script detects it is close to the PHP timeout limit. (This might be good way to import large files, however it can break transactions.) ) which does not work for me. Given that I'm using CPanel & PHPMyAdmin to get the job done.
How can import this database?
You can use BigDump for this
Adjust the database configuration and charset in this file
Remove the old tables on the target database if your dump doesn't contain "DROP TABLE"
Create the working directory (e.g. dump) on your web server
Upload bigdump.php and your dump files (.sql, .gz) via FTP to the working directory
Run the bigdump.php from your browser via URL like
http://www.yourdomain.com/dump/bigdump.php
BigDump can start the next import session automatically if you enable the JavaScript
Wait for the script to finish, do not close the browser window
IMPORTANT: Remove bigdump.php and your dump files from the web server
If Timeout errors still occure you may need to adjust the $linepersession setting in this file. Read more
Very Simple and Effective Technique to import large mysql databases.
Using Command Line console
you can access command line using putty for server and execute following command
mysql -u 'database_user' -p'database_password' database_name < sql_file_name_with_full_path
Using Cron Job [if console is not available]
add a cron job in cpanel with following command
mysql -u 'database_user' -p'database_password' database_name < sql_file_name_with_full_path
Do not forget to delete cron job after importing database. Also delete sql file from server.
for both techniques commands are same
Example
mysql -u 'test_user' -p'123456' test_db < /home1/test/public_html/db.sql
or if you do not have password
mysql -u 'test_user' test_db < /home1/test/public_html/db.sql
In my opinion and experience with hepsiawebhosting.com server, it's better and faster to set those parameters under WHM settings called "Tweak setting". Under Tweak settings you can modify maximum upload and maximum post, and you can could, for example, change upload to 120 MiB and post to 125 MiB.
Also, in PHP settings under WHM, you can change the default socket and SQL time out. You need to increase those settings.
You can also unzip the database and try to upload it as a simple .sql file.
I hope this will help you.
why this is not published, what is missing here?