当前位置:网站首页>MySQL 8.0.29 set and modify the default password
MySQL 8.0.29 set and modify the default password
2022-08-02 06:05:00 【m0_66557301】
MySQL 8.0.29 set and modify default password
*Change password:
When logging in, an error was reported because you did not set the initial password of root.
The password is stored in encrypted form in the authentication_string field in the user table in the mysql database.
Reference link:
Do not change the password by
sudo mysql -u root -pto log in directly.
Modification steps:
Modify mysqld.cnf
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf*You can use code without vim.

Add to this fileThe command "skip -grant-tables"
allows you to log in without entering a password.
Restart mysql
service mysql restart// Similarly, there are alsoservice mysql startservice mysql stopLogin to mysql
mysql -u root -pYou will be prompted for a password, but you will be able to log in without entering it.
Modify user table
use mysql ;update user set authentication_string='' where user='root';//Modify the password property to empty.The plugin field of root is

Remember to flush privileges;
update user set plugin='mysql_native_password' where user='root';Change it to
p>
ALTER user 'root'@'localhost' IDENTIFIED BY 'whq2242';
quit
- The password can now be changed.

Comment out the one added in mysqld.cnf and restart mysql
You can log in normally.

Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
猜你喜欢
随机推荐
canvas 像素操作(图片像素操作)
ORA-04044:此处不允许过程、函数、程序包或类型,系统分析与解决
H5如何实现唤起APP
mysql练习题
go语言中的goroutine(协程)
2022河南萌新联赛第(四)场:郑州轻工业大学 A - ZZULI
力扣练习——41 对称二叉树
matlab simulink 飞机飞行状态控制
[Errno 13] Permission denied:’/usr/local/share/jupyter’
力扣练习——33 原子的数量
单调队列模板 滑动窗口
CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!)
力扣练习——45 二叉树的锯齿形层次遍历
MySql字符串拆分实现split功能(字段分割转列、转行)
Qt FAQ
力扣练习——48 找到小镇的法官
找倍数(DAY 98)
2022年7月学习计划完成情况
Mycat2.0搭建教程
学内核之五:问题一,关于上下文切换









