dejanmarkovic
11/13/2013 - 3:42 PM

Changing MySQL password in Xampp

Changing MySQL password in Xampp

I. First disable grant tables
stop the MySQL service through Administrator tools, Services.
Modify the my.ini configuration file (assuming default paths) located in C:\xampp\mysql\bin

In the SERVER SECTION, under [mysqld], add the following line:
skip-grant-tables

... so that you have
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

skip-grant-tables

-- SERVER SECTION MAY LOOK DIFFERENT --

Start the service again and you should be able to log into your database without a password.

BUT if you want continue and change root password:

1. in command line go to C:\xampp2\mysql\bin
2. run mysql.exe -u root -p
3. when asked for password press eneter(means no passwrd)
4. To make sure user root doesn't have password please type
UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root';

6. OPTIONAL if you chioose to use password (SET Password=PASSWORD('your_password_here'))
Then you will have to change password in phpMyAdmin (STEP 7)
7. C:\xampp\phpMyAdmin\config.inc.php
$cfg['Servers'][$i]['password']='root';

8. delete skip-grant-tables from  my.ini configuration file located in C:\xampp\mysql\bin