首先 cmd 进入命令行
mysql -uroot -p
2、查询版本号
select version();
看一下数据库
show databases;
使用mysql即可
进行查询 user、host
select user,host from user;
修改root的密码
alter user 'root'@'%' identified by '1234';
刷新权限
flush privileges;
Microsoft Windows [版本 10.0.19045.2251](c) Microsoft Corporation。保留所有权利。C:\Users\cj>mysql -uroot -pEnter password: ****Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 5707Server version: 8.0.33 MySQL Community Server - GPLCopyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.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 changedmysql> 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>
来源地址:https://blog.csdn.net/weixin_46085718/article/details/131429634