Automated root password reset on new install
Posted by:
Ian Blair
Date: April 19, 2013 09:33AM
Hi,
I'm trying to upgrade our builds to MySQL-server 5.6, using the Centos 5 RPMs. One of the updates in 5.6 is a random root password which is written to ~/.mysql_secret.
I need to automate install of this new version, which includes setting the root password to something else, and then installing our databases. I've finally got this to work from the the command line using:
# RP=`cat ~/.mysql_secret |grep random|cut -d: -f4-|sed 's| ||g'|tail -1`
# mysql -uroot -p$RP --init-command='set password for root@localhost = password("newrootpassword")' &
# kill -9 `jobs -p`
However, when I put the same into a shell script, I get the following:
Warning: Using a password on the command line interface can be insecure.
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
Which is the same is if you try to pass a command to SQL on the commandline before the root password is changed.
Does anybody know why this is happening/how I can get around it?
Thanks in Advance!
Subject
Written By
Posted
Automated root password reset on new install
April 19, 2013 09:33AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.