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)
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)
sudo mysql -u root
use mysql;
SELECT user, plugin FROM user;
UPDATE user SET plugin = "mysql_native_password" WHERE user = "root" ;
SELECT user, plugin FROM user;
exit
service mysql restart
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: