Best Answer · By JanBask MS SQL Server Expert
Answered on Mar 5, 2021
In MySQL, as a matter of course, the username will be root and there will not be any password.
In the event that you inadvertently kept a password and failed to remember, here is the manner by which to reset the password:
End the MySQL worker 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 here.