tags:

views:

109

answers:

1

Is it possible to create mysql database from fabric dynamically.

This seems like it gets stuck at the password prompt

run('mysql -u %s -p %s -h %s  ' % (env.mysqluser, env.mysqlpassword, env.mysqlhost), pty=True)
run('CREATE DATABASE %s; ' % (dataname), pty=True)
run('exit', pty=True)
+1  A: 

Try instead

run('echo "CREATE DATABASE %s;"|mysql --batch --user=%s --password=%s --host=%s' % (dataname, env.mysqluser, env.mysqlpassword, env.mysqlhost), pty=True)
Conspicuous Compiler