I want to include 3 tables SQL dump into that database, how to add it by using a custom module or script or any best practice.
- 
 Export table sql and login mysql and run mysql command?Sohel Rana– Sohel Rana2021年04月20日 04:05:57 +00:00Commented Apr 20, 2021 at 4:05
- 
 I can't access my mysql directly, is there any way to import my tables? any php script?zus– zus2021年04月20日 04:10:34 +00:00Commented Apr 20, 2021 at 4:10
- 
 check this link phppot.com/php/import-csv-file-into-mysql-using-php/…Msquare– Msquare2021年04月20日 04:27:13 +00:00Commented Apr 20, 2021 at 4:27
- 
 I need to import tables dumpzus– zus2021年04月20日 04:51:04 +00:00Commented Apr 20, 2021 at 4:51
- 
 @zus let me know if given solution works for you. Thanks!Rahul Barot– Rahul Barot2021年04月22日 08:25:43 +00:00Commented Apr 22, 2021 at 8:25
1 Answer 1
Put your mysql dump file xyz.sql in pub folder and create a file with below code to import in pub folder
pub\custom_import.php
<?php
$db_host = "localhost";
$db_user = "root";
$db_pass = "root";
$db_name = "m242ee";
$sql = file_get_contents('ktpl_bannerslider_banner_slider.sql');
$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);
/* execute multi query */
$result = $mysqli->multi_query($sql);
if($result){
 echo 'Sql imported successfully.';
}
In order to import multiple dump files you can modify above script as per your requirements.
Now execute this file from browser for ex. http://example.com/custom_import.php
If your magento setup is not pointing to pub then do this same process on magento root.