To save the bash as create_mysql.sh, we can create a database magento
and a user magento_user
with full privileges by password
.
mysqlword="xyzzy"
mysql -u root -p$mysqlword -e"CREATE DATABASE magento;"
mysql -u root -p$mysqlword -e"use magento;"
mysql -u root -p$mysqlword -e"CREATE USER magento_user@localhost IDENTIFIED BY 'password';"
mysql -u root -p$mysqlword -e"GRANT ALL PRIVILEGES ON magento.* TO magento_user@localhost IDENTIFIED BY 'password';"
mysql -u root -p$mysqlword -e"FLUSH PRIVILEGES;"
mysql -u root -p$mysqlword -e"exit"
How to rewrite the bash scripts to do the same task with postgresql, as an automatic script not interactive command in psql?