Fill these in once
- Try logging in without a password
mysql -u rootHomebrew's MySQL starts with no root password.
- Then set one
mysql_secure_installation
- Log in as root through sudoNeeds sudo
sudo mysqlOn Ubuntu, root uses your Linux login instead of a password.
- Optional: give root a password for apps that need oneNeeds sudo
sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'change-me';"
- Log in with the root password you set during install
mysql -u root -p - Still denied? Force a network login
mysql -u root -p -h 127.0.0.1