在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

MySQL如何修改root账号密码

132次阅读
没有评论

共计 2708 个字符,预计需要花费 7 分钟才能阅读完成。

这篇文章给大家分享的是有关 MySQL 如何修改 root 账号密码的内容。丸趣 TV 小编觉得挺实用的,因此分享给大家做个参考,一起跟随丸趣 TV 小编过来看看吧。

MySQL 数据库中如何修改 root 用户的密码呢?下面总结了修改 root 用户密码的一些方法

1:使用 set password 语句修改

mysql select user();
+—————-+
| user() |
+—————-+
| root@localhost |
+—————-+
1 row in set (0.08 sec)

mysql set password=password(123456
Query OK, 0 rows affected (0.00 sec)

mysql flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql exit

2: 更新 mysql 数据库的 user 表

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 password=PASSWORD(QwE123) where user= root
Query OK, 4 rows affected (0.03 sec)
Rows matched: 4 Changed: 4 Warnings: 0

mysql flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql quit

3:使用 mysqladmin 命令修改

命令一般为 mysqladmin -u root -p oldpassword password newpass 如下所示:

[root@DB-Server ~]# mysqladmin -u root -p 123456 password Qwe123
Warning: Using a password on the command line interface can be insecure.

验证 root 密码修改是否成功

[root@DB-Server ~]# mysqladmin -u root -p 123456 password Qwe123
Warning: Using a password on the command line interface can be insecure.

上面都是在知道 root 密码的情况下修改 root 密码,如果忘记了 root 密码,如何修改 root 的密码呢?

1:首先停掉 MySQL 服务

[root@DB-Server ~]# service mysql stop
Shutting down MySQL..[OK]
[root@DB-Server ~]# 

[root@DB-Server ~]# /etc/rc.d/init.d/mysql stop
Shutting down MySQL..[OK]

2:然后使用 mysqld_safe 命令启动 mysql,更新 root 账号的密码

–skip-grant-tables:不启动 grant-tables(授权表), 跳过权限控制。

–skip-networking:跳过 TCP/IP 协议,只在本机访问 (这个选项不是必须的。可以不用) 是可以不用

[root@DB-Server ~]# mysqld_safe –user=mysql –skip-grant-tables –skip-networking
[1] 5145
You have new mail in /var/spool/mail/root
[root@DB-Server ~]# 150709 14:10:53 mysqld_safe Logging to /var/lib/mysql/DB-Server.localdomain.err .
150709 14:10:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@DB-Server ~]# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise Server – Advanced Edition (Commercial)

Copyright (c) 2000, 2014, 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 show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| test |
+——————–+
4 rows in set (0.00 sec)

mysql use mysql
Database changed
mysql UPDATE user SET password=PASSWORD(Qwe123) WHERE user= root  
Query OK, 4 rows affected (0.01 sec)
Rows matched: 4 Changed: 4 Warnings: 0

mysql flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql exit
Bye

3:重新启动 MySQL 服务。

感谢各位的阅读!关于“MySQL 如何修改 root 账号密码”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-27发表,共计2708字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 九九热在线观看视频 | 色花堂国产精品原创第一页 | 中文字幕在第10页线观看 | www.99热这里只有精品 | 久久久久激情免费观看 | 国产最新精品 | 91影视在线 | 色黄大色黄女片免费看软件 | 同事激情 | 日本特级黄毛片毛片视频 | 99精品久久久久久久免费看蜜月 | 久久人 | 亚洲香蕉国产高清在线播放 | 人人妻人人澡人人爽人人精品电影 | 日本真人边吃奶边做爽电影 | 成人a毛片免费观看网站 | 久久亚洲私人国产精品va | 午夜电影网va内射 | 高清国产精品人妻一区二区 | 欧美高清一区二区 | a级大胆欧美人体大胆666 | 青青青在线观看国产精品 | 色多多免费视频观看区一区 | 国产一区二区三区欧美 | 香蕉911 | 最新国产在线观看 | 青青久精品观看视频最新 | 一本伊大人香蕉久久网手机 | 亚洲欧美日韩高清综合678 | 少女韩国电视剧在线观看完整 | 天天干夜夜操 | 日韩高清在线中文字带字幕 | 一级毛片高清免费播放 | 国内精品伊人久久久影院 | 亚洲精品久久 | 天堂8在线新版官网 | 亚洲图片色图 | 免费一级网站免费 | 色综合网天天综合色中文男男 | 国产精品麻豆久久久 | 图片区网友自拍另类图区 |