init_user => admin mysql
This commit is contained in:
parent
b2f9132c4d
commit
3fa0cbf10d
19
dockerfiles/mysql/5.6/official/init_user.sh
Normal file
19
dockerfiles/mysql/5.6/official/init_user.sh
Normal 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 "========================================================================"
|
19
dockerfiles/mysql/5.7/official/init_user.sh
Normal file
19
dockerfiles/mysql/5.7/official/init_user.sh
Normal 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 "========================================================================"
|
19
dockerfiles/mysql/8.0/official/init_user.sh
Normal file
19
dockerfiles/mysql/8.0/official/init_user.sh
Normal 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 "========================================================================"
|
Loading…
Reference in New Issue
Block a user