当前位置:网站首页>[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
边栏推荐
- Vertx restful style web router
- Paper learning -- Study on the similarity of water level time series of Xingzi station in Poyang Lake
- Shengsi mindspire is upgraded again, the ultimate innovation of deep scientific computing
- 項目經驗分享:實現一個昇思MindSpore 圖層 IR 融合優化 pass
- C2-关于VCF文件合并的几种方法
- Segment read
- 技术干货|AI框架动静态图统一的思考
- Lombok -- simplify code
- Pat class a 1032 sharing
- Technology dry goods | luxe model for the migration of mindspore NLP model -- reading comprehension task
猜你喜欢

Unity XR实现交互(抓取,移动旋转,传送,射击)-Pico

【MySQL 12】MySQL 8.0.18 重新初始化

Paper learning -- Study on the similarity of water level time series of Xingzi station in Poyang Lake

Analysis of the problems of the 12th Blue Bridge Cup single chip microcomputer provincial competition

Various postures of CS without online line

Technical dry goods Shengsi mindspire elementary course online: from basic concepts to practical operation, 1 hour to start!

技术干货|昇思MindSpore初级课程上线:从基本概念到实操,1小时上手!

技术干货 | AlphaFold/ RoseTTAFold开源复现(2)—AlphaFold流程分析和训练构建

技术干货|百行代码写BERT,昇思MindSpore能力大赏

圖像識別與檢測--筆記
随机推荐
JUnit unit test of vertx
pgAdmin 4 v6.11 发布,PostgreSQL 开源图形化管理工具
微软安全响应中心
Technical dry goods Shengsi mindspire lite1.5 feature release, bringing a new end-to-end AI experience
Technical dry goods Shengsi mindspire innovation model EPP mvsnet high-precision and efficient 3D reconstruction
Go language foundation ----- 07 ----- method
【LeetCode】2. Valid Parentheses·有效的括号
Qtip2 solves the problem of too many texts
技术干货|昇思MindSpore创新模型EPP-MVSNet-高精高效的三维重建
Vertx metric Prometheus monitoring indicators
研究显示乳腺癌细胞更容易在患者睡觉时进入血液
【CoppeliaSim4.3】C#调用 remoteApi控制场景中UR5
Analysis of the eighth Blue Bridge Cup single chip microcomputer provincial competition
PAT甲级 1030 Travel Plan
lucene scorer
华为交换机Console密码重置、设备初始化、默认密码
VMware network mode - bridge, host only, NAT network
Unified handling and interception of exception exceptions of vertx
How long is the fastest time you can develop data API? One minute is enough for me
Technical dry goods | hundred lines of code to write Bert, Shengsi mindspire ability reward