1、首先 cmd 進入命令行
mysql -uroot -p
?2、查詢版本號
select version();
3、看一下數(shù)據(jù)庫
show databases;
4、使用mysql即可
5、進行查詢 user、host
select user,host from user;
6、修改root的密碼文章來源:http://www.zghlxwxcb.cn/news/detail-508822.html
alter user 'root'@'%' identified by '1234';
7、刷新權(quán)限文章來源地址http://www.zghlxwxcb.cn/news/detail-508822.html
flush privileges;
Microsoft Windows [版本 10.0.19045.2251]
(c) Microsoft Corporation。保留所有權(quán)利。
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>
到了這里,關(guān)于mysql 8.0版本更換用戶密碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!