Many use Php+mysql station webmaster friends, often to use the phpMyAdmin database management tools to back up and restore the database, when the site runs for a long time, the MySQL database will be very large, when the site encountered problems, need to use phpMyAdmin to recover the database, However, when importing large SQL files, due to the limitations of the PHP upload file and the response time of the script can not be imported, will show failure, but we have to import to the MySQL database, how to do? The following by me for everyone to explain it, can help to the needs of webmaster friends!
Tools/Materials
- MySQL management tool phpMyAdmin
- MySQL file
- notepad++
Method/Step
- 1
Under the phpMyAdmin directory, Find the config.inc.php file in the root directory, if there is no config.inc.php file, you can copy the config.sample.inc.php file in the root directory, rename it to config.inc.php, save it! :
- 2
Then open the config.inc.php file with notepad++, find the code
$cfg [' uploaddir '] = ';
This parameter is set to import large SQL file storage directory, here the value is set to: Importbigsql, the code is:
$cfg [' uploaddir '] = ' importbigsql ';
Then save the file:
- 3
Next we create a folder named Importbigsql in the phpMyAdmin directory:
- 4
Put the SQL database file that we need to import into the Importbigsql folder below:
- 5
Log in to phpMyAdmin, select the MySQL data file you want to import, and click the "Import" button above the navigation bar:
- 6
Select the "Select from Web server upload folder importbigsql/:" option and select the SQL data file that you want to import:
- 7
Finally, click "Execute" to import the large SQL data file you need:
- 8
After a while, phpMyAdmin shows that we need to import the SQL file, import successfully, we need to import the large SQL file and import successfully, you can test the site, whether it can be accessed,:
END
Precautions
- If the config.inc.php file is not found $cfg [' uploaddir '] = '; You can add them to the file yourself and fill in the corresponding parameters.
- The parameter value Importbigsql can be set by itself, but the folder name created by phpMyAdmin is the same as the set parameter value.
How to import large capacity. sql files with phpMyAdmin