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>

相关推荐
友莘居士3 分钟前
高效处理 Excel 海量数据入库:编程脚本、CSV 中间件、图形工具优化全攻略
数据库·中间件·excel·csv·海量数据·入库
Han.miracle44 分钟前
数据库圣经第二章——简单的my.ini基础配置介绍
数据库
八怪2 小时前
KILL MTS的一个worker线程会怎么样
数据库
disanleya2 小时前
MySQL数据库安装后,如何设置自动化备份策略?
mysql
奥尔特星云大使2 小时前
mysql高可用架构之MHA部署(二)VIP漂移(保姆级)
android·mysql·架构·mha·ip漂移
-Xie-2 小时前
Mysql杂志(三十一)——Join连接算法与子查询、排序优化
数据库·mysql
程序新视界3 小时前
在连表查询场景下,MySQL隐式转换存在的坑
数据库·mysql·dba
九河云3 小时前
在云计算环境中实施有效的数据安全策略
大数据·网络·数据库·云计算
咋吃都不胖lyh3 小时前
MySQL 与Power BI 的作用,以及在数据分析中扮演的角色
mysql·数据分析·powerbi