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>

相关推荐
张铁铁是个小胖子4 小时前
redis执行lua脚本的原子性和数据库原子性的区别
数据库·redis·lua
源图客4 小时前
Spark读取MySQL数据库表
数据库·mysql·spark
xiucai_cs6 小时前
MySQL深分页慢问题及性能优化
数据库·mysql·性能优化·深分页
当牛作馬6 小时前
ES常用查询命令
数据库·mysql·elasticsearch
chenglin0168 小时前
ES_索引的操作
大数据·数据库·elasticsearch
hzp6668 小时前
阿里云的centos8 服务器安装MySQL 8.0
mysql·阿里云·centos8
共享家95279 小时前
MYSQL库及表的操作
数据库
想回家的一天11 小时前
Go1.25的源码分析-src/runtime/runtime1.go(GMP)
数据库·redis·缓存
阿里云大数据AI技术12 小时前
鹰角网络基于阿里云EMR Serverless StarRocks的实时分析工程实践
数据库·数据分析