Bug #90796 Trying to install Mysql and set root password, not working on Ubuntu 18.04
Submitted: 9 May 2018 3:48 Modified: 12 May 2018 17:51
Reporter: Nirmal Sarswat Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.7.22 OS:Ubuntu (18.04 Gnome shell)
Assigned to: CPU Architecture:x86

[9 May 2018 3:48] Nirmal Sarswat
Description:
I installed mysql server on my Ubuntu 18.04 and setup root password, other things from mysql_secure_installation. After setting up all there, I stop the mysql server and started it, can't login to mysql from shell.
I tried all available methods like stopping mysql, skip grant tables, login to mysql and alter password in configuration table but in the same my mysql socket locks and unable to login. Everything was fine in Ubuntu 16.04 but  have problem in 18.04.

How to repeat:
 I am not a great Linux/Unix developer, please help.
[9 May 2018 8:13] MySQL Verification Team
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.
[9 May 2018 12:15] MySQL Verification Team
Please provide the description step by step of the install process you did. Thanks.
[12 May 2018 2:59] Nirmal Sarswat
I used following instruction to setup
> sudo apt-get install mysql-server
> mysql_secure_installation
> systemctl restart mysql / service mysql restart

After doing this I used the password, which I set in mysql_secure_installation, for login but that did not worked :)
[12 May 2018 17:51] MySQL Verification Team
Thank you for the bug report.
[14 May 2018 5:39] Lars Tangvald
There's a workaround for this, I believe (assuming I understand the issue correctly)

If, when installing MySQL on Ubuntu, you enter an empty root password or use a noninteractive installation, the root user will be set up with unix socket authentication, meaning only your unix root can log in as MySQL root.
If this is the case for you, you should be able to log in by simply typing "sudo mysql"

The bug is that mysql_secure_installation doesn't change the authentication type, so even after running it you will still have unix socket authentication set up.

To change the root user to use normal password authentication, do the following:

* Log in with "sudo mysql"
* In the client interface, type "alter user 'root'@'localhost' identified with 'mysql_native_password' by 'YOURPASS';"

This should reset your root user to password authentication
[14 May 2018 6:25] Lars Tangvald
Posted by developer:
 
This seems to be the same issue as #24431140: mysql_secure_installation doesn't set the auth plugin when used to set a root password