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)
There's a better way of doing this using mysqladmin:
run('mysqladmin -u %s -p%s create %s' % (user, password, dbname))
Try instead
run('echo "CREATE DATABASE %s;"|mysql --batch --user=%s --password=%s --host=%s' % (dataname, env.mysqluser, env.mysqlpassword, env.mysqlhost), pty=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With