Is this correct to change the root password of MySql?
echo "use mysql; update user set password=PASSWORD("NEWPASSWORD") where User='root'; flush privileges; quit;" | mysql -u root -pOLDPASSWORD
I've seen this doc and a few others, but I don't find one "simple" definitive answer in a few lines.
Also, should I stop
mysql server before doing it, and restarting it after? (I tried
mysql stop or
mysql -uroot -pOLDPASSWORD stop on my Debian but none of them worked).
mysql -V gives
mysql Ver 14.14 Distrib 5.5.40, for debian-linux-gnu (x86_64).