MySQL5.7.37安装配置

1.下载MySQL软件包并解压

2.配置环境变量

3.新建my.ini文件并输入信息

bash 复制代码
[mysqld]
#端口号
port = 3306
#mysql-5.7.27-winx64的路径
basedir=C:\mysql-5.7.37\mysql-5.7.37-winx64
#mysql-5.7.27-winx64的路径+\data
datadir=C:\mysql-5.7.37\mysql-5.7.37-winx64\data 
#最大连接数
max_connections=200
#编码
character-set-server=utf8
 
default-storage-engine=INNODB
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
 
[mysql]
#编码
default-character-set=utf8 
 

4.以管理员身份运行cmd 输入下载命令安装MySQL

sql 复制代码
mysqld -install

mysqld --initialize

mysqld --initialize

net start mysql

注意:如果出现以下错误 那么我们需要去下载一下所需要的文件

下载地址:https://www.microsoft.com/zh-CN/download/details.aspx?id=40784

5.修改密码

java 复制代码
skip-grant-tables 将其添加在my.ini文件中 


net stop mysql  重启一下mysql

net start mysql

mysql -u root -p  直接回车回车

use mysql


update user set authentication_string=password("123456") where user="root";

然后在my.ini中删掉这句话 保存退出

6.停掉MySQL服务-MySQL 右键停止

7.再次登录mysql

java 复制代码
C:\mysql-5.7.37\mysql-5.7.37-winx64\bin> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。


C:\mysql-5.7.37\mysql-5.7.37-winx64\bin> mysql -u root -p
Enter password: 123456
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

use mysql报错 我们重置一下密码
mysql> alter user user() identified by "123456";
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql
Database changed
mysql>

重置密码 大功告成

相关推荐
一叶龙洲16 分钟前
wslg打开Ubuntu24.04默认打开图形界面
linux·服务器·数据库·ubuntu
敖行客 Allthinker2 小时前
Parallels Ubuntu虚拟机项目如何让手机访问?完整解决方案
linux·运维·ubuntu
keyipatience3 小时前
线程栈与TLS和线程互斥
java·linux·服务器·开发语言·ubuntu
元Y亨H3 小时前
生产环境监控与故障应急处理(5-5-5 标准)指南
运维
j7~3 小时前
【Linux】二十二.《Linux 信号机制完全指南:表示、捕捉与处理》
linux·信号处理·volatile·可入重函数·保存信号
踏月的造梦星球4 小时前
达梦数据库执行计划与性能分析入门:EXPLAIN、AUTOTRACE 与 ET
服务器·数据库·oracle
观山岳五楼4 小时前
Ubuntu 24 怎么使用Ubuntu 20 的镜像源
linux·运维·ubuntu
星夜夏空995 小时前
网络编程(1)
服务器·网络
川石课堂软件测试5 小时前
安全测试|常见SQL注入攻击方式、实例及预防
服务器·数据库·sql·功能测试·测试工具·安全·单元测试
m0_715646765 小时前
20260720
linux·arm