MySQL安装报错解决

发布于:2025-07-05 ⋅ 阅读:(13) ⋅ 点赞:(0)

1.按下 Ctrl + Shift + Esc 组合键打开任务管理器,切换到"详细信息"选项卡,终止所有 mysqld.exe 进程。

2.删除下载的mysql数据库中data所有的文件和文件夹。

3.在以管理员身份打开的命令提示符中,初始化新的数据目录(生成随机root密码)

mysqld --initialize --console

4.执行命令后,请注意控制台输出的临时 root 密码,其格式为: [Note] 为 root@localhost 生成的临时密码:xxxxxxxx

5.使用临时密码登录

mysql -u root -p

6.修改root密码

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_new_password');

7.显示类似Query OK, 0 rows affected, 1 warning (0.00 sec)即代表成功

8.cmd->services.msc,找到MYSQL,右键,点击停止即可。

9.在下载的MYSQL文件中找到my.ini文件,删除其中的skip-grant-tables,

my.ini文件如下所示。

[mysqld]
port = 3306
basedir=D:/mysql-5.7.26-winx64
datadir=D:/mysql-5.7.26-winx64/data

max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

skip-grant-tables 删掉

[mysql]

10.执行以下步骤即实现验证安装成功。 

C:\Windows\System32>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26 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> use mysql
Database changed
mysql>


网站公告

今日签到

点亮在社区的每一天
去签到