专业网站建设品牌,十四年专业建站经验,服务6000+客户--广州京杭网络
免费热线:400-683-0016      微信咨询  |  联系我们

ubuntu2004修改mysql密码_数据库

当前位置:网站建设 > 技术支持
资料来源:网络整理       时间:2023/3/5 16:35:06       共计:3603 浏览
ubuntu2004修改mysql密码?

先进入root模式:

sudo -s

1

1

然后输入命令mysql

root@ubuntu:/home/cdd/Desktop/Django/typeidea-env/typeidea/typeidea# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 22

Server version: 8.0.21-0ubuntu0.20.04.4 (Ubuntu)

Copyright (c) 2000, 2020, 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>

1

2

3

4

5

6

7

8

9

10

11

12

13

14

1

2

3

4

5

6

7

8

9

10

11

12

13

14

下面就是修改初始密码的步骤:

现在mysql命令下输入

mysql> use mysql

1

1

然后修改密码:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '你的新密码';

1

1

到这里新密码就设置好了,下面我们登录下:

$ mysql -u root -p

Enter password: # 这里输入你的新密码

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 28

Server version: 8.0.21-0ubuntu0.20.04.4 (Ubuntu)

Copyright (c) 2000, 2020, 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.

mys

版权说明:
本网站凡注明“广州京杭 原创”的皆为本站原创文章,如需转载请注明出处!
本网转载皆注明出处,遵循行业规范,如发现作品内容版权或其它问题的,请与我们联系处理!
欢迎扫描右侧微信二维码与我们联系。
·上一条:Docker有什么优势_数据库 | ·下一条:字段别名及应用_数据库

Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有    粤ICP备16019765号 

广州京杭网络科技有限公司 版权所有