欢迎来访 CSWL官方博客 http://bbs.cswl.top/ 本站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请点击[ 这里]进行反馈处理!
0 0 0

mysql命令行修改数据库的方法

陈哥 站长 创始人 V
2025-06-03 63

MySQL修改初始密码三种方法:

方法一:

1、使用空的初始密码登录mysql账号:

mysql-uroot -p

 2、修改root密码:

SETPASSWORD = PASSWORD('123456');

方法二:

1、使用空的初始密码登录mysql账号:

mysql-uroot -p

2、修改root密码:

mysqladmin -u root password '123456'

方法三:

1、使用空的初始密码登录mysql账号:

mysql-uroot -p 

2、修改root密码:

mysql> update user set Password=password("123456") 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.04 sec)

mysql> select Host,User,password from user where user='root';

+-----------------------+------+-------------------------------------------+

| Host | User | password |

+-----------------------+------+-------------------------------------------+

| localhost | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |

| localhost.localdomain | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |

| 127.0.0.1 | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |

| ::1 | root | *5626ED34B75C6C508BA2A3D0A4F6E4C58823138C |

+-----------------------+------+-------------------------------------------+

4 rows in set (0.00 sec)


下载声明

每次下载将扣除 1个元宝,VIP会员免费下载,元宝可通过 /发布主题/签到/回帖/获得!
拥有真气  :排行
拥有元宝  :
兑换
拥有灵石  :  0枚充值
关闭
最新回复 (0)

    暂无评论

请先登录后发表评论!

返回
请先登录后发表评论!