On Debian and Ubuntu the root account authenticates through the unix_socket plugin, so sudo mysql -u root logs in without a password. Use this to bootstrap a password for root. On other systems root may need -p.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.