I'm trying to import a Wordpress database via the command line, using PHP.
Yes, I know I can use the cPanel to do it via the phpMyAdmin (which is what I just did).
I would like to have a simple php file that I can import the database without having to log into cPanel, as I'm probably going to be doing this often for testing purposes on a production Wordpress blog for a customer.
What I have in the php file:
The only output I get is the same as if I entered 'mysql -?` from the command line.
I have verified that the username, password, database, and dump file names are all correct. When I changed it to a mysqldump command (with appropriate syntax changes), it worked fine.
I figure there is something I'm missing, but can't figure it out.
Need help
Yes, I know I can use the cPanel to do it via the phpMyAdmin (which is what I just did).
I would like to have a simple php file that I can import the database without having to log into cPanel, as I'm probably going to be doing this often for testing purposes on a production Wordpress blog for a customer.
What I have in the php file:
Code:
<?php system('mysql -h localhost -u MyUserName -p MyPassword -d MyDatabase < MyDumpFile;'); ?>
I have verified that the username, password, database, and dump file names are all correct. When I changed it to a mysqldump command (with appropriate syntax changes), it worked fine.
I figure there is something I'm missing, but can't figure it out.
Need help
Comment