Step by step how you can change ‘root’ password

You must have rights to stop/start services, and kill process.

Step 1: Stop MySql service run: services.msc …

Step 2 : Create file to reset password You can use your password and your file name. We use password : Pass1Word2 and file name : C:\temp\reset.txt

1
2USE mysql;
3UPDATE mysql.user SET Password=PASSWORD('Pass!Word@') WHERE User='root';
4FLUSH PRIVILEGES;

Step 3 : Find our my.ini file It is usually locate on ‘C:\ProgramData\MySQL\MySQL Server ????\my.ini’ But, you can try to find using :

1</div>
2
3<div>C:\
4dir my.ini /s /b</div>
5
6<div>

You can check MySQL service’s property.

For this sample, we use this: C:\ProgramData\MySQL\MySQL Server 5.5\my.ini

Step 4 : Navigate to MySql bin directory Open command prompt there.

Type command :

1
2mysqld --defaults-file="C:\\ProgramData\\MySQL\\MySQL Server 5.5\\my.ini" --init-file=C:\temp\reset.txt

Attention : Use double “\\” insted “\”

Step 5 : Open “Task Manager” and kill process “mysqld.exe”

Step 6: Start service “MySql”

By now, we have a new password.

 1
 2cls
 3@echo off
 4cls
 5echo.
 6echo * * * Reset MySql password * * *
 7echo.
 8pause
 9echo.
10echo Stop MySql Service
11echo.
12sc stop MySql
13echo.
14pause
15echo.
16echo Kill mysqld.exe
17echo.
18taskkill -f -im mysqld.exe
19echo.
20pause
21echo.
22rem dir "C:\ProgramData\MySQL\MySQL Server 5.5\my.ini"
23echo.
24echo Run MySqlD
25echo.
26"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld"   --defaults-file="C:\Program Files\MySQL\MySQL Server 5.5\my.ini" --init-file=C:\Temp\reset.txt
27echo.
28pause
29echo.
30echo Start MySql Service
31echo.
32sc start MySql
33echo.
34pause
35echo.
36echo Try to connect
37echo.
38"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysql.exe" "--defaults-file=C:\Program Files\MySQL\MySQL Server 5.5\my.ini" "-uroot" "-p"
39echo.
40cd\temp
41echo.</div>
42
43<div>

** Attention : Make sure all file are ANSI