- @echo off & setlocal enableDelayedExpansion
-
- set "mysql=D:\wamp64\bin\mysql\mysql5.7.26\bin\mysql.exe" & rem 改为你的路径
- set "o_pwd=原密码"
-
- set "dic=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~@#$_[]{}:,.+-"
-
- set "newpwd="
- for /L %%i in (1 1 15) do (
- set /a j=!random! %% 76
- for %%j in (!j!) do set "newpwd=!newpwd!!dic:~%%j,1!"
- )
- set newpwd
-
- >modify_pwd.sql (
- echo SET PASSWORD FOR 'root'@'localhost' = PASSWORD('%newpwd%'^);
- )
- start "" notepad.exe modify_pwd.sql
-
- "%mysql%" -uroot -p%o_pwd% < modify_pwd.sql
-
- echo;password modify complete, new password is:
- echo;%newpwd%
- pause
复制代码
|