** Description changed:

- Install the 16.04 package mysql-server and immediately run
- mysql_secure_installation to set the root database password. When
- complete, the root database password you chose doesn't work. You are
- locked out from mysql.
+ If MySQL 5.7 is installed with an empty password, UNIX socket
+ authentication will be enabled for the root user. If the user then tries
+ to set a root password using mysql_secure_installation or mysqladmin,
+ the command will appear to succeed, but the user will still only allow
+ access through socket authentication. This is a bug in
+ mysqladmin/mysql_secure_installation.
  
- Steps to reproduce this issue on a fresh Xenial system:
+ Upstream bug: http://bugs.mysql.com/bug.php?id=81965
  
- 1. sudo apt-get install mysql-server
- 2. sudo mysql_secure_installation
- 3. Respond to the questions:
+ To reproduce:
  
- - Validate password plugin?  No
- - New password: foobarblat
- - Re-enter new password: foobarblat
- - Remove anonymous users?  Y
- - Disallow root login remotely? Y
- - Remove test database and access to it? Y
- - Reload privilege tables now? Y
+ 1. sudo apt-get install mysql-server (noninteractive or enter empty password)
+ 2. sudo mysqladmin -uroot password 'pass' (seems to succeed)
+ 3. mysql -uroot -ppass (access denied)
  
- 4. mysql -p -u root
- Enter password: foobarblat
- ERROR 1698 (28000): Access denied for user 'root'@'localhost'
+ Workaround:
  
+ User needs to manually set auth plugin back to password with an sql:
+ 1. Log in with sudo mysql
+ 2. run «ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' 
BY 'pass';»
+ 
+ Or from command line:
+ sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 
'mysql_native_password' BY 'pass';"
+ 
+ ---
  Other people have encountered the same problem:
  
http://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04

** Description changed:

  If MySQL 5.7 is installed with an empty password, UNIX socket
  authentication will be enabled for the root user. If the user then tries
  to set a root password using mysql_secure_installation or mysqladmin,
  the command will appear to succeed, but the user will still only allow
  access through socket authentication. This is a bug in
  mysqladmin/mysql_secure_installation.
  
  Upstream bug: http://bugs.mysql.com/bug.php?id=81965
  
  To reproduce:
  
  1. sudo apt-get install mysql-server (noninteractive or enter empty password)
- 2. sudo mysqladmin -uroot password 'pass' (seems to succeed)
- 3. mysql -uroot -ppass (access denied)
+ 2. sudo mysqladmin -uroot password 'mypass' (seems to succeed)
+ 3. mysql -uroot -pmypass (access denied)
  
- Workaround:
+ Workarounds:
  
+ a) Set plugin after installation:
  User needs to manually set auth plugin back to password with an sql:
  1. Log in with sudo mysql
- 2. run «ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' 
BY 'pass';»
+ 2. run «ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' 
BY 'mypass';»
  
  Or from command line:
- sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 
'mysql_native_password' BY 'pass';"
+ sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH 
'mysql_native_password' BY 'mypass';"
  
+ b) Set password before installation:
+ It's possible to script the answer to the root password query using 
debconf-set-selections as shown below
+ 1. debconf-set-selections <<EOT
+ mysql-server-5.7 mysql-server/root_password password mypass
+ mysql-server-5.7 mysql-server/root_password_again password mypass
+ EOT
+ 2. apt-get install mysql-server
  ---
  Other people have encountered the same problem:
  
http://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1610574

Title:
  mysql_secure_installation/mysqladmin cannot set password when
  auth_socket is enabled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-5.7/+bug/1610574/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to