I am trying to crate a shell script that would:
- connect to a remote server that has MYSQL running
- On success run "CREATE DATABASE foo;"
So far I tried:
#!/bin/bash mysql -h 188.8.131.52 -u root -p'XXXXXXX' mysql> CREATE DATABASE foo;
echo "CREATE DATABASE foo;";
But no success.
I am using the command line to run the shell script.
# sh create_mysql_database.sh
but all it does is force mysql to connect and wait for input and that is it.
Anyone knows how to actually achieve this?
Server: Centos 6.2 MySQL client version: 5.1.61