欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mysql8.0中zip的安装方法

程序员文章站 2022-04-10 08:19:21
...

测试环境:

Windows10专业版
MySQL版本:mysql-8.0.21-winx64(MySQL下载地址

步骤

1.解压

MySQL下载后是一个压缩包,我解压到了D盘,大家注意盘符问题,看好自己的。
mysql8.0中zip的安装方法

2.配置文件

在这里边新建一个,my.ini文件,复制下边内容。

[mysqld]
default_authentication_plugin=mysql_native_password
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
 
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
 
# These are commonly set, remove the # and set as required.
basedir=D:\mysql-8.0.21-winx64
datadir=D:\mysql-8.0.21-winx64\data(会自动生成data文件,主要修改这两行内容,复制后,记得将括号里的文字删除!!!)
port = 3306
# server_id = .....
 
 
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
 
character-set-server = utf8mb4
 
performance_schema_max_table_instances = 600
table_definition_cache = 400
table_open_cache = 256
 
[mysql]
default-character-set = utf8mb4
 
[client]
default-character-set = utf8mb4

3.初始化mysql数据库

在MySQL安装目录的 bin 目录下执行此命令:

.\mysqld --initialize --console

初始化结束后,会出现root的初始密码,记住,随后需要用这个密码进行登录。
mysql8.0中zip的安装方法

4.安装mysql服务

在MySQL安装目录的 bin 目录下执行此命令:

.\mysqld --install mysql

PS:安装完成后,切记不要忘了启动服务:
net start mysql

PS:注意!!若是出现了Install/Remove of the Service Denied!问题,将cmd.exe用管理员身份来进行登录,即可解决

5.登录修改密码

.\mysql -uroot -p

输入之前记录的初始密码

修改:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';(password是你设置的密码)
FLUSH PRIVILEGES; 
相关标签: mysql