1.检查版本
mysql -V
mysql Ver 8.0.15 for Win64 on x86_64 (MySQL Community Server - GPL)
2.启动mysql8
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.15 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
3.进入数据库的MySQL
use mysql
Database changed
4修改mysql8密码
ALTER user 'root'@'localhost' IDENTIFIED BY 'root'
Query OK, 0 rows affected (0.03 sec)
4.1mysql5的修改方法
update user set password=password("root") where user="root"
Query OK, 1 rows affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0
5.刷新数据库
flush privileges;
Query OK, 0 rows affected (0.01 sec)
6.退出mysql8
quit
Bye
7.mysql登录检验
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.15 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
注意:并没有修改C:\ ProgramData \ MySQL \ MySQL Server 8.0下的my.ini文件,即:加入skip-grant-tables
然后保存my.ini文件,接着win + x R打开service.msc重启mysql8,最后再按照1-7步骤操作
本文由 芒果雪花汁 发布
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Aug 9, 2019 at 03:28 pm