当前位置:网站首页>【Linux】【Mysql】ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘
【Linux】【Mysql】ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘
2022-06-28 04:10:00 【amRobinson】
Tools :
mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64)
Problem description :
Ubuntu Upon completion of installation mysql after , No direct access mysql -u root -p Command login mysql, The following error occurred :ERROR 1698 (28000): Access denied for user ‘root’@‘localhost’
resolvent :
Ubuntu linux Install new version under mysql, When installing root The code is random , Therefore, the above error occurs .
First step , Sign in mysql
Since we can't pass root User access MySQL, Then we can only log in through other users MySQL 了 . After we download and install MySQL The system creates a user for us . open /etc/mysql/debian.cnf as follows .
[email protected]:~$ sudo cat /etc/mysql/debian.cnf
[email protected]:~$ sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = 0NBFUVaaRF8KiZBD
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = 0NBFUVaaRF8KiZBD
socket = /var/run/mysqld/mysqld.sock
We find client Of user and password, Then input... At the terminal mysql -u debian-sys-maint -p
And then enter password The content of . This is the way to enter MySQL 了 , Pictured :
[email protected]:~$ mysql -u debian-sys-maint -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.38-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
The second step , see user surface
stay mysql Input in :
select user, plugin from mysql.user,
give the result as follows :
+------------------+-----------------------+
| user | plugin |
+------------------+-----------------------+
| root | auth_socket |
| mysql.session | mysql_native_password |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+
4 rows in set (0.00 sec)
The third step , modify root password
Enter the following command , among 123456 It's a password :
update mysql.user set authentication_string=PASSWORD('123456'), plugin='mysql_native_password' where user='root';
mysql> update mysql.user set authentication_string=PASSWORD('123456'), plugin='mysql_native_password' where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
Step four , Refresh
Enter the following command :
flush privileges;
Then restart the server , You can log in normally
sudo service mysql restart
边栏推荐
- 2021年终总结及2022年展望
- English notes - cause and effect
- 电学基础知识整理(一)
- sqlserver 数据库之事物使用入门 案例
- How to write a software test report? Here comes the third party performance report template
- 美创入选“2022 CCIA中国网络安全竞争力50强”榜单
- How to write anti shake throttling for small programs?
- Understanding and learning of parental delegation mechanism
- Does the applet input box flash?
- Leetcode: monotonic stack structure (Advanced)
猜你喜欢

Understanding and learning of parental delegation mechanism

设计一个有getMin功能的栈

MSC 307(88) (2010 FTPC Code)第2部分烟气和毒性测试

iptables防火墙规则和firewalld防火墙规则详解

Detailed explanation of KVM common commands

Pycharm setting pseudo sublime color scheme

leetcode - 329. 矩阵中的最长递增路径

GenICam GenTL 标准 ver1.5(2)

Adder - Notes

数字电路学习笔记(一)
随机推荐
Analysis of future teacher research ability under steam education framework
sqlserver 数据库之事物使用入门 案例
多项目开发入门,基础设计 类库项目使用
What is the process of en 1101 flammability test for curtains?
猫狗队列的问题
MSc 307 (88) (2010 FTPC code) Part 5 low flame spread test
第一个.net core MVC项目
Arrangement of basic electrical knowledge (II)
等保2.0密码要求是什么?法律依据有哪些?
GenICam GenTL 标准 ver1.5(2)
Several important physical concepts
利用ELK 搭建日志分析系统(二)—— 部署安装
Uncertainty principle
Particle theory of light (photoelectric effect / Compton effect)
Pychart shares third-party modules among different projects
Chapter 14 AC-DC power supply front stage circuit note I
利用ELK 搭建日志分析系统(一)—— 组件介绍
03 MongoDB文档的各种增加、更新、删除操作总结
Meichuang was selected into the list of "2022 CCIA top 50 Chinese network security competitiveness"
上线MES系统后,企业发生了这些变化......