bspacer1 bspacer2
webmail hosting forum clients about

Computer Co-op, CornerNET Internet Gateway, and PJR Solutions is owned by PJR Sales & Service. Quality products and online services since 1991. We can be your
Complete Computer Connection

Hosting @ $5.95

Domains @ $16.98
Home PagePortal HomeClient AreaAnnouncementsKnowledgebaseSupport TicketsDownloadsRegister

Knowledgebase
You are here: Portal Home > Knowledgebase > cPanel Related Issues > MySQL management issues > How do I use a PHP script for MySQL database import?

How do I use a PHP script for MySQL database import?

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 import.php file, e.g. http://yourdomain.com/import.php.


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



Was this answer helpful?

Add to Favourites
Print this Article

Also Read
How can I import a large database to my account? PhpMyAdmin times out. (Views: 11279)
I get an error 'ACCESS DENIED CREATE DATABASE db_name' when I try to import a database (Views: 10054)
I get syntax error when trying to run a MySQL query. (Views: 1060)
I don't have enough privileges for creating/dropping databases in PhpMyAdmin (Views: 2706)
I have problems accessing my MySQL database remotely (Views: 5298)

Powered by WHMCompleteSolution


Copyright © 1994-2021 PJR Sales and Service All Rights Reserved