1、 获取mysql-5.7.34-winx64.zip,解压到F:\kindoapp
2、 在F:\kindoapp\mysql-5.7.34-winx64目录中创建my.ini并写入下面内容:
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[mysqld]
#设置端口
port = 3206
basedir=F:\kindoapp\mysql-5.7.34-winx64
datadir=F:\kindoapp\mysql-5.7.34-winx64\data
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
max_connections = 800
max_connect_errors = 1000
max_allowed_packet = 1000M
innodb_file_per_table = 1
innodb_log_file_size=148M
innodb_page_size=32k
#skip-grant-tables 加这个参数关闭登录密码验证
3、以管理员身份运行cmd,依次执行下面命令
F:
cd F:\kindoapp\mysql-5.7.34-winx64\bin
.\mysqld.exe --initialize --console
.\mysqld.exe --initialize-insecure --user=mysql #初始为空密码
如果出现:
由于找不到MSVCR120.dll,无法继续执行代码.重新安装程序可能会解决此问题
需要下载安装 Visual C++ Redistributable Packages for Visual Studio 2013 x64
mysqld: Could not create or access the registry key needed for the MySQL application
to log to the Windows EventLog. Run the application with sufficient
privileges once to create the key, add the key manually, or turn off
logging for that application.
需要以管理员运行
到data目录查看.err文件,修复出现的错误,此文件中包括了root密码:
A temporary password is generated for root@localhost: h,go6w0oKche
.\mysqld.exe -install mysql57
net start mysql57
启动有问题,删除服务解决问题再重新安装
.\mysqld.exe -remove mysql57
4、 登录mysql
.\mysql --port 3206 -uroot -p
修改密码:
alter user 'root'@'localhost' identified by '123456';
grant all privileges on *.* to 'root'@'%' identified by '123456';
flush privileges;
Window安装解压版本mysql5.7
最新推荐文章于 2023-07-04 17:11:46 发布
本文详细介绍了如何在Windows上安装和配置MySQL 5.7.34,包括创建配置文件my.ini,设置端口和字符集,解决依赖问题,初始化数据库,安装服务,以及登录并修改root用户的密码。过程中提到了可能遇到的错误及解决方法,如MSVCR120.dll缺失和注册表权限问题。
5716

被折叠的 条评论
为什么被折叠?



