For some reason, the script below doesn't reset the root password. The script works in that it performs the steps, but when I try to log back in to mysql as root with the new password, it doesn't recognize the change and insists I use the old one.
Here is the script below:
#!/bin/bash
echo "Resetting root password"
sudo /etc/init.d/mysql stop
sleep 2
if [ -f /root/mysql.reset.sql ]; then
rm -f /root/mysql.reset.sql
touch /root/mysql.reset.sql
else
touch /root/mysql.reset.sql
fi
echo "UPDATE mysql.user SET Password=PASSWORD('akimbo') WHERE User='root'; FLUSH
PRIVILEGES;" >> /root/mysql.reset.sql
mysqld_safe --init-file=/root/mysql.reset.sql &
/etc/init.d/mysql start
sleep 2
echo "Done setting mysql password for user root. Password is password."
So when I try mysql -uroot -pakimbo it complains and only works when i use the old password.
Any ideas?
cheers