yesっていうコマンドがあるんだよ
exec('yes | create database hogehoge');

-yオプション的なのををサポートしてるかどうかはそのコマンドのマニュアル読んで