2

I test all the suggested answers but still I canon't reset or remove password or even reinstall the mysql db on Ubuntu 16.04, Is there any ohter idea?

#1045 - Access denied for user 'root'@'localhost' (using password: YES)

2 Answers2

0
  1. Open your terminal
  2. sudo mysql -u root
  3. use mysql;
  4. SELECT user, plugin FROM user;
  5. UPDATE user SET plugin = "mysql_native_password" WHERE user = "root" ;
  6. SELECT user, plugin FROM user;
  7. exit
  8. service mysql restart
-1

Have you can update new for the MySQL root password on Ubuntu Linux. Enter the following lines below:

1. Stop the MySQL Server: sudo /etc/init.d/mysql stop
2. Start the mysqld configuration: sudo mysqld --skip-grant-tables &
3. Login to MySQL as root: mysql -u root mysql
4. Replace "newpassword" with your new password:

UPDATE mysql.user SET Password = PASSWORD('newpassword') WHERE User = 'root'; FLUSH PRIVILEGES; exit;

Note: on some versions, if password column doesn't exist, you may want to try:
UPDATE user SET authentication_string=password('newpassword') WHERE user='root';

After changed pass success. however, it works.

References:

  1. http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/
  2. https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
Kotler
  • 589