wok view mysql/stuff/reset-password.sh @ rev 20185

Up tcc (0.9.27)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 01 14:55:28 2018 +0100 (2018-02-01)
parents
children
line source
1 #!/bin/sh
3 [ -z "$1" ] && echo "Usage: $0 <newpassword>" && exit 1
5 /etc/init.d/mysql stop
6 /usr/bin/mysqld_safe --skip-grant-tables &
7 mysql <<EOT
8 UPDATE `mysql`.`user` SET `Password` = password('$1') WHERE `User` = "root" AND Host = "localhost";
9 quit
10 EOT
11 mysqladmin shutdown
12 /etc/init.d/mysql start