Database

Set MySQL Root User Password using XAMPP

Set MySQL Root User Password using XAMPP

The MySQL root user is a special account in MySQL with full administrative privileges. It has full control and unrestricted access to all databases and tables and can execute any command. It’s the default administrative account created during MySQL installation.

Set MySQL Root User Password

The general steps to set the root user password using the XAMPP control panel are as follows:

Open the XAMPP control panel.

Click on the Shell and open the XAMPP shell.

At the Shell prompt,  run the following command on the localhost:

# mysql -u root -p

and press the Enter key.

It will ask for a password; by default, it is blank, so press the Enter key.

 

Set MySQL Root User Password

Set Password

Then just run the following query

> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘secret’);

 

Set Password for MySQL root user

This example sets the password as “secret”. In reality, you should protect the root user password with a strong password that combines uppercase and lowercase letters, numbers, and special characters.

Press the Enter key and the password will be updated for the root user.

That’s it. You have successfully set the password for the root user.

Because of its powerful privileges, it’€™s important to use the root user carefully to avoid security risks.

MySQL Tutorials

MySQL Tutorials on this website: