Knowledgebase
Webinova Online Customer Support > Webinova Help Desk > Knowledgebase

Search help:


PHP script for MySQL database import

Solution

You should start by creating a file called for example import.php and placing it in your public_html folder.

Then edit the file and paste the following code in it:

 <?php

passthru("nohup mysql -u USERNAME -pPASSWORD DBNAME < dump.sql");

 ?>


Where USER,PASSWORD and DBNAME are your details for the database in which you want to import the dumped file, and dump.sql is the file you want to import. Make sure you give the correct path to the dump.sql file.

When you are ready, open your browser and type in the URL to the update.php file, e.g. http://yourdomain.com/update.php.

To test if the import was successful, log in to your phpMyAdmin tool from your cPanel and review the database.

 
Was this article helpful? yes / no
Article details
Article ID: 198
Category: cPanel MySQL Databases
Date added: 2012-12-07 13:08:20
Views: 25
Rating (Votes): Article rated 3.0/5.0 (6)

 
« Go back

 
Powered by Help Desk Software HESK - brought to you by Help Desk Software SysAid