Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me what is the default password of MySQL?

1 Answer

0 votes
by (119k points)

In MySQL, by default, the username will be root and there won’t be any password.

If you accidentally kept a password and forgot, here is how to reset the password:

Terminate the MySQL server and restart it with the –skip-grant-tables option.

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

After that, connect to the MySQL Server using the MySQL client:

 mysql -u root

After that, run this command to reload the grant tables:

FLUSH PRIVILEGES;

Now you can set a new password:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

If you want to learn MySQL from top professionals, then register for this SQL Certification program by Intellipaat.

Also, watch this video on MySQL:

Related questions

0 votes
1 answer
asked Dec 22, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Jun 26, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...