This one has me banging my head.... I have a script that asks for input such as the mysql root password that a user wants to set on a new install and then performs these actions for them. I'm missing something in the variable expansion though. I ask for the mysql root password ($MYPW), and also get the hostname from the environment ($HNAME=`hostname`). I'm trying to set them like this:
Code:
echo "SET PASSWORD FOR 'root'@'localhost' = PASSWORD(\'$MYPW\');" | mysql -u root
echo "SET PASSWORD FOR 'root'@\'$HNAME\' = PASSWORD(\'$MYPW\');" | mysql -u root -p$MYPW
But that didn't work. Can someone see offhand what I've borked or a different way to accomplish this?
Thanks in advance!