wok-6.x diff mysql/stuff/reset-password.sh @ rev 20261
Up linux 3.16.55
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Mar 15 11:24:25 2018 +0100 (2018-03-15) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mysql/stuff/reset-password.sh Thu Mar 15 11:24:25 2018 +0100 1.3 @@ -0,0 +1,12 @@ 1.4 +#!/bin/sh 1.5 + 1.6 +[ -z "$1" ] && echo "Usage: $0 <newpassword>" && exit 1 1.7 + 1.8 +/etc/init.d/mysql stop 1.9 +/usr/bin/mysqld_safe --skip-grant-tables & 1.10 +mysql <<EOT 1.11 +UPDATE `mysql`.`user` SET `Password` = password('$1') WHERE `User` = "root" AND Host = "localhost"; 1.12 +quit 1.13 +EOT 1.14 +mysqladmin shutdown 1.15 +/etc/init.d/mysql start