MySQL Change Root Password In XAMPP

note:  as of MariaDB 10.4, this post is no longer effective.

See https://mariadb.org/authentication-in-mariadb-10-4/

Good post about how to change root password for MYSQL in XAMPP:

http://veerasundar.com/blog/2009/01/how-to-change-the-root-password-for-mysql-in-xampp/

Here’s  briefly how to do it:

  • Start Apache and Mysql
  • Goto localhost/phpmyadmin
  • Type in following SQL command: UPDATE mysql.user SET Password=PASSWORD(‘password’) WHERE User=’root’; FLUSH PRIVILEGES;
  • Open the file [XAMPP Installation Path] / phpmyadmin / config.inc.php in your favorite text editor.
  • Search for the string $cfg\['Servers'\]\[$i\]['password'] = ''; and change it to like this, $cfg\['Servers'\]\[$i\]['password'] = 'password'; Here the ‘password’ is what we set to the root user using the SQL query.
  • You are done.  Restart the servers.