当前位置:网站首页>[MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
[MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
2022-07-03 07:43:00 【Rusty well began】
1、 Can be in my.cnf Add code skip-grant-tables
vi/etc/my.cnf
stay my.cnf Add code to file skip-grant-tables( namely : Skippable MySQL Login with password authentication )
2、 restart MySQL:
systemctl restart mysqld
3、 Sign in MYSQL
No need to use a password , You can log in directly MySQL
[root@localhost /]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7
Server version: 8.0.18 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. 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.
4、 Change Password
<1> First set the original password to empty
mysql>update user set authentication_string="" where user='root';
<2> Then in my.cnf Delete... From file skip-grant-tables, Then enter again mysql
<3>mysql>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' password ‘;
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set authentication_string="" where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> exit
Bye
[root@localhost /]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 30
Server version: 8.0.18
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. 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.
mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'siteweb1!';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'siteweb1!';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
5、 Refresh mysql Related system permission table
flush privileges;
6、 Get rid of my.cnf Add code to file skip-grant-tables
Get rid of my.cnf Add code to file skip-grant-tables
7、 restart MySQL
systemctl restart mysqld
边栏推荐
- Pat class a 1028 list sorting
- Lucene merge document order
- Vertx multi vertical shared data
- Technology dry goods | luxe model for the migration of mindspore NLP model -- reading comprehension task
- Redis配置文件
- 【MySQL 13】安装MySQL后第一次修改密码,可以可跳过MySQL密码验证进行登录
- Inverted chain disk storage in Lucene (pfordelta)
- Analysis of the eighth Blue Bridge Cup single chip microcomputer provincial competition
- 华为S5700交换机初始化和配置telnet,ssh用户方法
- 【LeetCode】2. Valid Parentheses·有效的括号
猜你喜欢

Various postures of CS without online line

项目经验分享:实现一个昇思MindSpore 图层 IR 融合优化 pass

Technical dry goods Shengsi mindspire innovation model EPP mvsnet high-precision and efficient 3D reconstruction

Lucene introduces NFA

【踩坑系列】mysql 修改root密码失败

截图工具Snipaste

VMware network mode - bridge, host only, NAT network

Go language foundation ----- 07 ----- method

技术干货|昇思MindSpore Lite1.5 特性发布,带来全新端侧AI体验

HCIA notes
随机推荐
技术干货|昇思MindSpore初级课程上线:从基本概念到实操,1小时上手!
The babbage industrial policy forum
Industrial resilience
Pat grade a 1027 colors in Mars
PDO and SDO concepts
Lombok -- simplify code
Structure of golang
Lucene hnsw merge optimization
HarmonyOS第三次培训笔记
Unity XR实现交互(抓取,移动旋转,传送,射击)-Pico
Lucene merge document order
一篇文章让你读懂-曼彻斯特编码
华为S5700交换机初始化和配置SSH和TELNET远程登录方法
Vertx's responsive redis client
An overview of IfM Engage
图像识别与检测--笔记
圖像識別與檢測--筆記
pgAdmin 4 v6.11 发布,PostgreSQL 开源图形化管理工具
Technical dry goods | hundred lines of code to write Bert, Shengsi mindspire ability reward
Go language foundation ----- 02 ----- basic data types and operators