当前位置:网站首页>[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
边栏推荐
- Technical dry goods | hundred lines of code to write Bert, Shengsi mindspire ability reward
- Technical dry goods | reproduce iccv2021 best paper swing transformer with Shengsi mindspire
- 技术干货|昇思MindSpore Lite1.5 特性发布,带来全新端侧AI体验
- PAT甲级 1028 List Sorting
- 【CoppeliaSim4.3】C#调用 remoteApi控制场景中UR5
- Harmonyos third training notes
- Leetcode 213: looting II
- Sent by mqtt client server of vertx
- Qtip2 solves the problem of too many texts
- 研究显示乳腺癌细胞更容易在患者睡觉时进入血液
猜你喜欢
![[Development Notes] cloud app control on device based on smart cloud 4G adapter gc211](/img/55/fea5fe315932b92993d21f861befbe.png)
[Development Notes] cloud app control on device based on smart cloud 4G adapter gc211

密西根大学张阳教授受聘中国上海交通大学客座教授(图)

技术干货|昇思MindSpore NLP模型迁移之Bert模型—文本匹配任务(二):训练和评估

技术干货|昇思MindSpore可变序列长度的动态Transformer已发布!

Pat class a 1028 list sorting

Go language foundation ----- 18 ----- collaboration security, mutex lock, read-write lock, anonymous lock, sync Once

Go language foundation ------ 12 ------ JSON

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

图像识别与检测--笔记

技术干货|利用昇思MindSpore复现ICCV2021 Best Paper Swin Transformer
随机推荐
What did the DFS phase do
Analysis of the problems of the 11th Blue Bridge Cup single chip microcomputer provincial competition
Vertx metric Prometheus monitoring indicators
EtherCAT state machine transition (ESM)
Technical dry goods | hundred lines of code to write Bert, Shengsi mindspire ability reward
List exercises after class
GoLang之结构体
Pat class a 1030 travel plan
【LeetCode】2. Valid Parentheses·有效的括号
UA camouflage, get and post in requests carry parameters to obtain JSON format content
The difference between typescript let and VaR
Responsive MySQL of vertx
IndexSort
OSPF experiment
技术干货|关于AI Architecture未来的一些思考
Partage de l'expérience du projet: mise en œuvre d'un pass optimisé pour la fusion IR de la couche mindstore
Vertx multi vertical shared data
Lombok -- simplify code
PAT甲级 1031 Hello World for U
Lucene introduces NFA