Question

Can´t set root password when installing MySQL server

Hi,

When I try to setup a root password for the MySQL server following this guide (https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) I always get the following error message: … Failed! Error: SET PASSWORD has no significance for user ‘root’@‘localhost’ as the authentication method used doesn’t store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters. So I can´t proceed with the installation. Does anybody know how I can solve this problem?

Best regards heusmich


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

  1. First Of all, You need to kill the mysql_secure_installation process. You need to run this command.
sudo killall -9 mysql_secure_installation
  1. Then You need to Set Password for the root user. First of all connect mysql server as root user.
sudo mysql

3.Now, You need to add a password for the root user with this command. NOTE: Replaceyour_new_strong_passwordWith Your Password.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_strong_password';
  1. Now exit from MySQL login.
exit;
  1. Now, You can run mysql_secure_installation command without facing any error.
sudo mysql_secure_installation
  1. Your error is resolved now. Source Of This Information https://perfectans.net/question/12/set-password-has-no-significance-for-user-root-localhost-as-the-authentication-method-used-doesn-t-store-authentication-data-in-the-mysql-server

Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y … Failed! Error: SET PASSWORD has no significance for user ‘root’@‘localhost’ as the authentication method used doesn’t store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters.

Hello there,

For fresh installations of MySQL, you’ll want to run the DBMS’s included security script. This script changes some of the less secure default options for things like remote root logins and sample users.

Run the security script with sudo:

sudo mysql_secure_installation

This will take you through a series of prompts where you can make some changes to your MySQL installation’s security options.

You can also check our tutorial on How To Install MySQL on Ubuntu 20.04

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04

Regards