diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-01-19 12:09:01 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-01-19 12:09:01 -0200 |
commit | 39758c6344d2e0a70871f5e47f8c124cb49849b8 (patch) | |
tree | 2d3ec1a87895f5fe88c85bb7372770bd68965867 /files/setmysqlpass.sh | |
parent | 6dbd3aa79b7fcd3dfa4682d1e5a8ad2f9fc87cbd (diff) | |
download | puppet-mysql-39758c6344d2e0a70871f5e47f8c124cb49849b8.tar.gz puppet-mysql-39758c6344d2e0a70871f5e47f8c124cb49849b8.tar.bz2 |
Setting root password
Diffstat (limited to 'files/setmysqlpass.sh')
-rw-r--r-- | files/setmysqlpass.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/files/setmysqlpass.sh b/files/setmysqlpass.sh new file mode 100644 index 0000000..586775e --- /dev/null +++ b/files/setmysqlpass.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# Set MySQL password. +# + +CONF="/root/.my.cnf" + +# Check config file +if [ ! -e "$CONF" ]; then + echo "File not found: $CONF" + exit 1 +fi + +# Get password from configuration +passwd="`grep ^'password='` $CONF | cut -d '=' -f 2" + +# Set the password +echo "USE mysql; UPDATE user SET Password=PASSWORD('$passwd') WHERE User='root' AND Host='localhost';" | /usr/bin/mysql -u root |