I am trying to import a .sql file to mysql database. The size of mysql file is around 90MB.
I also found a similar question how to import .sql file in mysql database using php
I am using this script which is similar to the other one
$mysqlDatabaseName = 'db_test';
$mysqlUserName = 'db_dev';
$mysqlPassword = '1234abcd';
$mysqlHostName = 'localhost';
$mysqlImportFilename = 'dbbackup.sql';
$command = 'mysql -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' < ' .$mysqlImportFilename;
exec($command,$output = array(),$worked);
switch($worked){
case 0:
echo "Import file ".$mysqlImportFilename." successfully imported to database ".mysqlDatabaseName.";
break;
case 1:
echo 'There was an error during import. Please make sure the import file is saved in the same folder as this script.';
break;
}
I am getting the following error
There was an error during import. Please make sure the import file is saved in the same folder as this script.
How can i fix it ??