当前位置:网站首页>MySQL 8.0.29 set and modify the default password
MySQL 8.0.29 set and modify the default password
2022-07-30 21:36:00 【front end cry】
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 -p
to 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 stop
Login to mysql
mysql -u root -p
You will be prompted for a password, but you won't need to enter it to log in.
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 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 Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Ali 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
边栏推荐
- cmd(命令行)操作或连接mysql数据库,以及创建数据库与表
- LeetCode·Daily Question·952. Calculate Maximum Component Size by Common Factor·Union Check
- 走进Redis,让你重新认识redis。绝不是表面
- Qt 同时生成动态库和静态库
- 共用体、共用体与结构体的区别、枚举之C语言犄角旮旯的知识
- [Limited Time Bonus] 21-Day Learning Challenge - MySQL from entry to mastery
- ClickHouse删除数据之delete问题详解
- MySQL删除表数据 MySQL清空表命令 3种方法
- 解决centos8 MySQL密码问题ERROR 1820 (HY000) You must reset your password using ALTER USER
- Niu Ke Xiaobaiyue Race 53 A-E
猜你喜欢
随机推荐
不用bs4的原因居然是名字太长?爬取彩票开奖信息
openim支持十万超级大群
TransGAN code reproduction - Jiutian Bisheng Platform
Chrome 配置samesite=none方式
Advanced c language: pointers (5)
Be careful with your dictionaries and boilerplate code
Motion Tuned Spatio-temporal Quality Assessmentof Natural Videos
MySql创建数据表
navicat连接MySQL报错:1045 - Access denied for user ‘root‘@‘localhost‘ (using password YES)
JDBC(详解)
小心你的字典和样板代码
A simple rich text editor
MySQL 灵魂 16 问,你能撑到第几问?
mysql 时间字段默认设置为当前时间
牛客网——业务分析-提取值
qt使用动态库(DLL)
MySQL 游标
Why do so many people who teach themselves software testing give up later...
MySQL cursors
Solve the problem of centos8 MySQL password ERROR 1820 (HY000) You must reset your password using the ALTER USER