i am trying to create a database using shell_exec and mysql commands. I do not want to use php built-in mysql_query because of severals reasons. However, i cant get the below command to execute successful. Anyone can show me some light on what went wrong?
$test = shell_exec("mysql -u root -pmypassword create database db_hello;");
var_dump($test);
The correct syntax is like this:
Or
Reference: http://www.electrictoolbox.com/run-single-mysql-query-command-line/
The issue might be the path to mysql in your php script. For me was : /usr/local/bin/mysqld (osx 10)