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: