Generally we use PHPmyadmin to restore our database . Suppose in some cases if you don't have access to your live server's cpanel , PHPmyadmin .
Now, you will learn to know that how to restore MySQL database from SQL File using PHP .
This is also useful for any user that if you want to allow to create a database backup from your website .
We will guide below in simple PHP script to restore mysql Database .
We have created a function 'database_restore' for better handling this task .
$db_host
– This is required and it specifies the hostname.
$user
$pass
– This is required and it specifies the database's password.
$db_name
– This is required and it specifies the database name that you wants to take backup.
$file_path
– This is required and it specifies the sql file's path
'; } // Reset temp variable to empty $templine = ''; } } return !empty($error)?$error:true; }
To use above function 'database_restore':
If you have any query , you can write on below comment . I will try my best to reply soon .
we also provide PHP advance level training .