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>

相关推荐
2603_96643726几秒前
拷贝中断文件丢失,电脑资料抢救实操方案
数据库·电脑
harmony&8 分钟前
MySQL 数据库从入门到实战:原理、安装与 SQL 详解
数据库·sql·mysql
艺杯羹16 分钟前
全栈信创落地实录:基于银河麒麟V10与达梦数据库DM8的SpringBoot工业级适配指南
java·数据库·spring boot·后端·spring
坚定信念,勇往无前6 小时前
mongodb的日志分割
数据库·mongodb
oradh9 小时前
Oracle TX 锁 Mode 4(Share)问题排查总结
数据库·oracle·tx 锁 mode 4·oracle tx 锁
2601_962065259 小时前
[MySQL] SQL优化之性能分析
java·sql·mysql
yi.Ist9 小时前
数据定义语言-DDL操作
数据库·学习·mysql·oracle·大海豚
阿kun要赚马内9 小时前
MySQL 索引基础
后端·mysql
2601_9632827711 小时前
工程项目、政企采购为什么优先选择对讲机批量采购?
数据库
Doraemomo11 小时前
SQLite数据库
数据库·sqlite