is the code given is executable in Windows system? as it seems to be Linux commands
echo 'create database foo2' | mysql -uroot
mysqldump --skip-triggers -uroot foo | mysql -uroot foo2
EDITED I am executing the following code but I am not getting what I expect..
<?php
mysql_connect('localhost','root','********');
echo 'create database pranav_chk'. | mysql -u root
mysqldump --skip-triggers -u root pranav_test | mysql -u root pranav_chk;
?>