Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ubuntu18.0.4 installs mysql and resolves ERROR 1698 (28000): Access denied for user & # 39

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

preface

I recently learned linux and changed win to ubuntu. The mysql installed before is no longer available. Now I will install mysql on ubuntu18.0.4 and record the problems encountered as follows:

Download and install mysql

Execute sudo apt-get install mysql-server

Because I have installed it here, so it will appear like this. You can check the installation version by mysql --version.

log in to MySQL

Execute the statement mysql -u root -p

where-u is user -p is port. ERROR 1698 (28000): Access denied for user 'root'@'localhost'. This should be caused by forgetting or not remembering the initialization password when we installed it before:

Here is how to solve this problem:

1. Enter sudo vim /etc/mysql/debian.cnf and we'll see the following:

The debian-sys-maint account is the mysql user automatically generated by the system when mysql is installed, and the corresponding password is the password of this user.

2. Login account debian-sys-maint:

mysql -u debian-sys-maint -p You can log in to mysql:

3. Change root account password:

input command use mysql;

Then enter the command:

UPDATE user SET authentication_string=PASSWORD ('the password you want to set') where USER ='root '; This is the password to set the root account.

Then enter the command quit, exit mysql, execute the mysql command sudo service mysql restart;

Error 1524 (HY000): Plugin 'msyql_native_password' is not loaded

At this time, the password has actually been modified successfully. The field of plugin root is auth_socket, which needs to be modified.

4. Change plugin:

Continue to log in using the debian-sys-maint account;

Execution instructions:

use mysql

Execution instructions:

select user,plugin from user;

Then execute the command:

update user set authentication_string =password ('the password you want to set'),plugin='mysql_native_password' where user='root';

Finally exit and restart mysql:

summary

The above is ubuntu18.0.4 introduced by Xiaobian to you to install mysql and solve ERROR 1698 (28000): Access denied for user 'root'@'localhost', I hope to help you, if you have any questions please give me a message, Xiaobian will reply to you in time. Thank you very much for your support! If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report