0、下载并解压zip版mysql
1、添加环境变量path的路径D:\mysql-5.7\bin;
2、在D:\mysql-5.7\中添加data文件夹
3、修改my-default.ini配置文件
basedir = D:\mysql-5.7
datadir = D:\mysql-5.7\data
tmpdir = D:\mysql-5.7\data
port = 3306
server_id = 1
4、管理员运行cmd.exe进入mysql所在的盘符
cd D:\mysql-5.7\bin
mysqld -install
mysqld --initialize
net start mysql
mysql -u root -p
5、参考D:\mysql-5.7\data\zht-PC.err文件中最后一行生成的密码并输入
如:[Note] A temporary password is generated for root@localhost: <iaHT5eHlQp_
6、修改密码
mysql> set password for root@localhost = password('sa');
时间: 2024-12-22 04:48:33