Go Back   Cloud Computing > Support > Tutorials and Documentation
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-22-11, 23:57
BOD Member
 
Join Date: Jun 2010
Posts: 175
Default PHP script to import MySQL database

PHP script to import MySQL database

We can use a script to import mysql database which can be easier and time consuming. All we need to do is create a phpfile say for example import.php and place it in our public_html folder so that it can be accessible.
Once it is created we just need to edit the file and paste the following code in it:

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


Make sure to replace the USER,PASSWORD and DBNAME with the database details 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 and complete path to the dump.sql file.

Once all done open your browser and type in the URL for update.php file, e.g. http://yourdomain.com/update.php.

And finally to test if it has been imported successful, just log in to your phpMyAdmin tool from your cPanel and review the database.
__________________
Carol.P
Reply With Quote
  #2 (permalink)  
Old 05-23-11, 06:14
BOD Member
 
Join Date: Apr 2011
Posts: 82
Default

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 23:48.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.