Web Hosting Forum | Lunarpages

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
August 20, 2014, 02:29:53 PM

Pages: [1]   Go Down
Author Topic: How To: Import a large MySql Script file  (Read 3192 times)
Spacescooter Operator
Offline Offline

Posts: 48

Whatever and ever...

« on: May 23, 2007, 08:13:48 PM »

Hello everyone!

I apologize if there has been a similar post . Soooo Cool
I have been having problems importing very large mysql script files using phpmyadmin. And I mean files larger than 50MB. PHPMyadmin tends to timeout especially if you are on a slow connection when using the import script file form. The default timeout is 300 seconds, so if you do not finish the http upload within that time frame, the script will time out (correct me if I'm wrong in this).
Anyways, I found an alternative:
1. Download phpmyadmin from http://www.phpmyadmin.net/home_page/downloads.php
2. Extract and FTP it to a subfolder in your site.
3. Log in to your control panel (Plesk or cPanel). In the Databases section, create a new MySql database. Then create a new MySQL user account that will have access to the database you created.
3. Create a file named config.inc.php. Open this file and paste the following code:

/* Servers configuration */
$i 0;

/* Server localhost (config:root) [1] */
$cfg['Servers'][$i]['host'] = 'localhost';   //our mysql host server
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'user';               //change this to MySQL user name you have created
$cfg['Servers'][$i]['password'] = 'pass';      //the mysql user password
$cfg['UploadDir'] = 'imports';                             //the all important setting. explained below
/* End of servers configuration */


The variable $cfg['UploadDir'] is name of the directory where SQL files have been uploaded by other means than phpMyAdmin (for example, ftp). If for example, you have uploaded phpmyadmin to http://mydomain.com/pma, create a subfolder under pma named imports
4. Upload config.inc.php to your phpmyadmin folder. Using your web browser, check if you have typed the correct settings. E.g. browse http://mydomain.com/pma. If the database you have created shows up, then we're good!
5. Upload your large mysql dump file to the folder name which you have specifed in $cfg['UploadDir']. In this case, the folder is imports.
6. After upload is done. Check your uploaded phpmyadmin in your browser. On the left frame, above the databases drop down menu, there are 4 icons: Home, Query Window, PhpMyadmin docu & MySQL docu. Click on the Query Window icon. A pop up window will show up where you can run sql queries. There is also an Import Files tab on this window. Click on it and you will see a drop down on the right side with a label web server upload directory: If you click on the dropdown, you will see the sql file you have uploaded in the imports folder
Click the Go button and phpmyadmin will import the file.

That's it!
-Do password protect your phpmyadmin directory.
-Make sure that your target database is the one active in the main phpmyadmin window before importing.

 Happy Happy Joy Joy Happy Happy Joy Joy
« Last Edit: January 04, 2013, 06:28:08 AM by scanman20 » Logged

Our On-line Pet Community
Need web application solutions? Just send me a message.
Own me!
Pages: [1]   Go Up
Jump to: