]>
git.proxmox.com Git - dab.git/blob - scripts/mysql_randompw
3 # Provides: mysql_randompw
4 # Required-Start: $local_fs mysql
9 # Short-Description: Generate random MySQL root password
10 # Description: Generate and set a random MySQL root password
15 HNAME
=`head -n 1 /etc/hostname|awk '{ print $1; }'`
17 if [ "X${HNAME}" = "Xlocalhost" ] ; then
21 echo "Generate random MySQL root password"
23 # set HOME dir (for .my.cfg)
27 UPASSWD
=`openssl rand -base64 9`
28 mysqladmin password
"${UPASSWD}"
30 cat <<EOF > /root/.my.cnf
36 chmod 0600 /root
/.my.cnf
38 if [ -x /sbin
/insserv
] ; then
39 /sbin
/insserv
-r mysql_randompw
40 rm -f /etc
/init.d
/mysql_randompw
42 rm -f /etc
/init.d
/mysql_randompw
43 update-rc.d
-f mysql_randompw remove