Jan Wagner bu gisti düzenledi 8 years ago. Düzenlemeye git
1 file changed, 1 insertion
create_debian-sys-maint_for_mysqladmin.sh
| @@ -4,6 +4,7 @@ MYSQLADMIN_CFG="/etc/mysql/mariadb.conf.d/90-mysqladmin.cnf" | |||
| 4 | 4 | PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'); | |
| 5 | 5 | # adjust /etc/mysql/debian.cnf (used as defaults file by system scripts) | |
| 6 | 6 | sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf | |
| 7 | + | sed -i "s/^user =.*$/user = debian-sys-maint/" /etc/mysql/debian.cnf | |
| 7 | 8 | # create config file for mysqladmin itself (maybe not needed) | |
| 8 | 9 | umask 066 | |
| 9 | 10 | cat > ${MYSQLADMIN_CFG} <<EOF | |
Jan Wagner bu gisti düzenledi 8 years ago. Düzenlemeye git
1 file changed, 4 insertions, 2 deletions
create_debian-sys-maint_for_mysqladmin.sh
| @@ -2,7 +2,9 @@ | |||
| 2 | 2 | MYSQLADMIN_CFG="/etc/mysql/mariadb.conf.d/90-mysqladmin.cnf" | |
| 3 | 3 | # generate password | |
| 4 | 4 | PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'); | |
| 5 | - | # create config file | |
| 5 | + | # adjust /etc/mysql/debian.cnf (used as defaults file by system scripts) | |
| 6 | + | sed -i "s/^password =.*$/password = ${PASS}/" /etc/mysql/debian.cnf | |
| 7 | + | # create config file for mysqladmin itself (maybe not needed) | |
| 6 | 8 | umask 066 | |
| 7 | 9 | cat > ${MYSQLADMIN_CFG} <<EOF | |
| 8 | 10 | [mysqladmin] | |
| @@ -14,4 +16,4 @@ EOF | |||
| 14 | 16 | umask 022 | |
| 15 | 17 | chown 0:0 ${MYSQLADMIN_CFG}; chmod 0600 ${MYSQLADMIN_CFG} | |
| 16 | 18 | # update credentials | |
| 17 | - | mysql -u root -p -e "GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '${PASS}' WITH GRANT OPTION;" | |
| 19 | + | mysql -u root -p -e "GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '${PASS}' WITH GRANT OPTION;" | |
waja bu gisti düzenledi 8 years ago. Düzenlemeye git
1 file changed, 17 insertions
create_debian-sys-maint_for_mysqladmin.sh(dosya oluşturuldu)
| @@ -0,0 +1,17 @@ | |||
| 1 | + | #!/bin/sh | |
| 2 | + | MYSQLADMIN_CFG="/etc/mysql/mariadb.conf.d/90-mysqladmin.cnf" | |
| 3 | + | # generate password | |
| 4 | + | PASS=$(perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'); | |
| 5 | + | # create config file | |
| 6 | + | umask 066 | |
| 7 | + | cat > ${MYSQLADMIN_CFG} <<EOF | |
| 8 | + | [mysqladmin] | |
| 9 | + | host = localhost | |
| 10 | + | user = debian-sys-maint | |
| 11 | + | password = ${PASS} | |
| 12 | + | socket = /var/run/mysqld/mysqld.sock | |
| 13 | + | EOF | |
| 14 | + | umask 022 | |
| 15 | + | chown 0:0 ${MYSQLADMIN_CFG}; chmod 0600 ${MYSQLADMIN_CFG} | |
| 16 | + | # update credentials | |
| 17 | + | mysql -u root -p -e "GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '${PASS}' WITH GRANT OPTION;" | |