MySQL安装报错解决

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>

相关推荐
悲伤小伞16 分钟前
9-MySQL_索引
linux·数据库·c++·mysql·centos
霖霖总总22 分钟前
[Redis小技巧24]Redis主从复制深度解剖:不只是SLAVEOF,Redis主从复制背后的RunID、Backlog
数据库·redis
不吃香菜学java34 分钟前
苍穹外卖-菜品分页查询
数据库·spring boot·tomcat·log4j·maven·mybatis
狼与自由34 分钟前
Redis 分布式锁
数据库·redis·分布式
skiy43 分钟前
redis 使用
数据库·redis·缓存
java修仙传1 小时前
数据库和缓存的一致性如何保证?
redis·mysql·mybatis
mygljx1 小时前
Redis 下载与安装 教程 windows版
数据库·windows·redis
奕成则成1 小时前
Redis 大 Key 问题排查与治理:原因、危害、实战方案
数据库·redis·缓存
Hoshino.411 小时前
基于Linux中的数据库操作——例题实操(3)
数据库
dapeng28701 小时前
Python异步编程入门:Asyncio库的使用
jvm·数据库·python