mysql 8.0版本更换用户密码的方法步骤
更新时间:2023年11月02日 09:28:33 作者:想买CT5的小曹
这篇文章主要给大家介绍了关于mysql 8.0版本更换用户密码的方法步骤,MySQL用户密码的修改是经常面临的一个问题,文中通过代码介绍的非常详细,需要的朋友可以参考下
1、首先 cmd 进入命令行
mysql -uroot -p

2、查询版本号
select version();

3、看一下数据库
show databases;

4、使用mysql即可

5、进行查询 user、host
select user,host from user;
6、修改root的密码
alter user 'root'@'%' identified by '1234';
7、刷新权限
flush privileges;
Microsoft Windows [版本 10.0.19045.2251] (c) Microsoft Corporation。保留所有权利。 C:\Users\cj>mysql -uroot -p Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5707 Server version: 8.0.33 MySQL Community Server - GPL Copyright (c) 2000, 2023, Oracle and/or its affiliates. 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> select version(); +-----------+ | version() | +-----------+ | 8.0.33 | +-----------+ 1 row in set (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | dongtou | | guozi | | information_schema | | jinkai | | kunshan | | kunshan02 | | kunshan03 | | membership_system | | mysql | | performance_schema | | sys | +--------------------+ 11 rows in set (0.53 sec) mysql> use mysql; Database changed mysql> select user,host from user; +------------------+-----------+ | user | host | +------------------+-----------+ | root | % | | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | +------------------+-----------+ 4 rows in set (0.61 sec) mysql> alter user 'root'@'%' identified by '1234'; Query OK, 0 rows affected (1.12 sec) mysql> alter user 'root'@'%' identified by '1234'; Query OK, 0 rows affected (0.44 sec) mysql> flush privileges; Query OK, 0 rows affected (1.43 sec) mysql>
总结
到此这篇关于mysql 8.0版本更换用户密码的文章就介绍到这了,更多相关mysql8.0更换用户密码内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
相关文章
使用mysql记录从url返回的http GET请求数据操作
这篇文章主要介绍了使用mysql记录从url返回的http GET请求数据操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2021-01-01
解决Linux下Tomcat向MySQL插入数据中文乱码问题
本文给大家介绍的是如何解决win平台下开发的项目移植到Linux平台后,向MySQL插入数据时中文出现乱码的问题,非常的简单实用,有需要的小伙伴可以参考下2018-04-04
MySQL定位长事务(Identify Long Transactions)的实现
在MySQL的运行中,经常会遇到一些长事务,本文主要介绍了MySQL定位长事务,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2024-09-09


最新评论