init_user => admin mysql

This commit is contained in:
Michael RICOIS 2018-03-27 16:38:46 +02:00
parent b2f9132c4d
commit 3fa0cbf10d
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#!/bin/bash
PASS=${MYSQL_ADMIN_PASSWORD:-$(pwgen -s 12 1)}
_word=$( [ ${MYSQL_ADMIN_PASSWORD} ] && echo "preset" || echo "random" )
echo "=> Creating MariaDB admin user with ${_word} password"
mysql -uroot -e "CREATE USER IF NOT EXISTS 'admin'@'%' IDENTIFIED BY '$PASS'"
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION"
echo "=> Done!"
echo "========================================================================"
echo "You can now connect to this MariaDB Server using:"
echo ""
echo " mysql -uadmin -p$PASS -h<host> -P<port>"
echo ""
echo "Please remember to change the above password as soon as possible!"
echo "MariaDB user 'root' has no password but only allows local connections"
echo "========================================================================"

View File

@ -0,0 +1,19 @@
#!/bin/bash
PASS=${MYSQL_ADMIN_PASSWORD:-$(pwgen -s 12 1)}
_word=$( [ ${MYSQL_ADMIN_PASSWORD} ] && echo "preset" || echo "random" )
echo "=> Creating MariaDB admin user with ${_word} password"
mysql -uroot -e "CREATE USER IF NOT EXISTS 'admin'@'%' IDENTIFIED BY '$PASS'"
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION"
echo "=> Done!"
echo "========================================================================"
echo "You can now connect to this MariaDB Server using:"
echo ""
echo " mysql -uadmin -p$PASS -h<host> -P<port>"
echo ""
echo "Please remember to change the above password as soon as possible!"
echo "MariaDB user 'root' has no password but only allows local connections"
echo "========================================================================"

View File

@ -0,0 +1,19 @@
#!/bin/bash
PASS=${MYSQL_ADMIN_PASSWORD:-$(pwgen -s 12 1)}
_word=$( [ ${MYSQL_ADMIN_PASSWORD} ] && echo "preset" || echo "random" )
echo "=> Creating MariaDB admin user with ${_word} password"
mysql -uroot -e "CREATE USER IF NOT EXISTS 'admin'@'%' IDENTIFIED BY '$PASS'"
mysql -uroot -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION"
echo "=> Done!"
echo "========================================================================"
echo "You can now connect to this MariaDB Server using:"
echo ""
echo " mysql -uadmin -p$PASS -h<host> -P<port>"
echo ""
echo "Please remember to change the above password as soon as possible!"
echo "MariaDB user 'root' has no password but only allows local connections"
echo "========================================================================"