Is it possible to create an empty database with one line of command in bash?
My newbie attempts have failed:
mysql -uroot $(create database mydatabase;)
I end up having to
create database mydatabase;
@Nitrodist's answer will work, but it's over-engineering the problem. MySQL's command-line client supports the very handy
You can of course substitute any valid SQL into there.
According to MySQL's documentation, the
You can use Process Substitution to accomplish this:
or you can just pipe it to the
Can't test this personally, but I think this should work.
Edit: Another option is to use the