Would you like to learn how to configure the MySQL service to force the use of authentication via a password? In this tutorial, we are going to show you how to configure the password authentication to the ROOT user account using the command-line of a computer running Ubuntu Linux.

• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• MySQL 8.0.21

Tutorial MySQL - Configure the authentication via Password

Install the MySQL service.

Copy to Clipboard

Access the MySQL command-line.

Copy to Clipboard

On the authentication prompt, a password is not required.

Copy to Clipboard

Verify the authentication plugin and the password configured to the ROOT user account.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

The MySQL ROOT account has no password configured.

The ROOT account is using the authentication plugin named AUTH_SOCKET.

Configure the ROOT account to use the plugin named MYSQL_NATIVE_PASSWORD.

Copy to Clipboard

Configure a password to the ROOT account of the MySQL service.

Copy to Clipboard

In our example, the password configured was KAMISAMA123.

Save your configuration and exit.

Copy to Clipboard

Try to access the MySQL service using the ROOT account and the new password.

Copy to Clipboard

Verify the authentication plugin and the password configured to the ROOT user account.

Copy to Clipboard

Here is the command output:

Copy to Clipboard

Congratulations! You successfully enabled the MySQL password authentication to the ROOT account.