当前位置:   article > 正文

mysql 8.0版本更换用户密码_mysql 8.0 修改密码

mysql 8.0 修改密码

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;
  1. Microsoft Windows [版本 10.0.19045.2251]
  2. (c) Microsoft Corporation。保留所有权利。
  3. C:\Users\cj>mysql -uroot -p
  4. Enter password: ****
  5. Welcome to the MySQL monitor. Commands end with ; or \g.
  6. Your MySQL connection id is 5707
  7. Server version: 8.0.33 MySQL Community Server - GPL
  8. Copyright (c) 2000, 2023, Oracle and/or its affiliates.
  9. Oracle is a registered trademark of Oracle Corporation and/or its
  10. affiliates. Other names may be trademarks of their respective
  11. owners.
  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  13. mysql> select version();
  14. +-----------+
  15. | version() |
  16. +-----------+
  17. | 8.0.33 |
  18. +-----------+
  19. 1 row in set (0.00 sec)
  20. mysql> show databases;
  21. +--------------------+
  22. | Database |
  23. +--------------------+
  24. | dongtou |
  25. | guozi |
  26. | information_schema |
  27. | jinkai |
  28. | kunshan |
  29. | kunshan02 |
  30. | kunshan03 |
  31. | membership_system |
  32. | mysql |
  33. | performance_schema |
  34. | sys |
  35. +--------------------+
  36. 11 rows in set (0.53 sec)
  37. mysql> use mysql;
  38. Database changed
  39. mysql> select user,host from user;
  40. +------------------+-----------+
  41. | user | host |
  42. +------------------+-----------+
  43. | root | % |
  44. | mysql.infoschema | localhost |
  45. | mysql.session | localhost |
  46. | mysql.sys | localhost |
  47. +------------------+-----------+
  48. 4 rows in set (0.61 sec)
  49. mysql> alter user 'root'@'%' identified by '1234';
  50. Query OK, 0 rows affected (1.12 sec)
  51. mysql> alter user 'root'@'%' identified by '1234';
  52. Query OK, 0 rows affected (0.44 sec)
  53. mysql> flush privileges;
  54. Query OK, 0 rows affected (1.43 sec)
  55. mysql>

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/439768
推荐阅读
相关标签
  

闽ICP备14008679号