Scenario

I had a rather odd encounter with MySql Community Server after I installed version 5.7.26 on Mac OS.

I downloaded the native DMG file, ran it which allowed me to use an installer to install MySql.

As the install was at the finishing touches, the MySql installer automatically gave me a temporary password using a dialogue box like the one below:

Note: Make sure you copy and store this temporary password. If you lose it, it can be recovered but it can cause you a lot of headache while doing so.

Problem

The next thing, naturally I opened up MySql Workbench and tried to configure a new MySql connection. I was expecting that I will be asked to setup a new password after I enter the temporary one, but wait, it gave me the following prompt:

Reset MySQL root password using ALTER USER statement after install on Mac

I googled and tried several things and none worked, until finally!!!

Solution: Setting first time password for MySql on Mac OS

Open up Terminal and enter the following command:

mysql -uroot -p'mytemporaryPassword'

Notice that there is no space between -uroot and -p'mytemporaryPassword'.

After successful login, enter the command:

SET PASSWORD = PASSWORD('xxxxx');

And you are good to go with your new password. Open MySql Workbench now and try to connect again.

Summary

Connecting to MySql Community Server 5.7.26 after installing it on Mac OS gives you a temporary password for root@localhost. This password needs to be reset upon your first login. But this cannot be done using MySql Workbench but by only using MySql server itself. Trying to connect though MySql Workbench will give you the warning Reset MySQL root password using ALTER USER statement after install on Mac. This post shows the solution to successfully change the password to a permanent one.

Credit