Mysql8.0 zip安装方法

版权声明:关注微信公众号:摸鱼科技资讯,联系我们 https://blog.csdn.net/qq_36949176/article/details/86037856

一、安装

1. 解压zip包到安装目录

H:\mysql-8.0.13-winx64

2.配置文件

windows系统中配置文件默认是安装目录下的 my.ini 文件,文件目录下不存在my.ini文件,所以我们新建了一个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=H:\mysql-8.0.13-winx64
datadir=H:\mysql-8.0.13-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安装目录的 bin 目录下执行命令:

.\mysqld --initialize --console

 执行完成后,会打印 root 用户的初始默认密码,我们需要记住初始密码。

4.安装服务、修改密码

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

.\mysqld --install [服务名]

后面的服务名可以不写,默认的名字为 mysql。

安装完成之后,就可以通过命令net start mysql启动MySQL的服务了。

我们输入:

.\mysql -uroot -p

这时候会提示输入密码,前面记住的密码,填入即可登录成功,进入MySQL命令模式。

在MySQL中执行命令:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';(注意一定要有分号,这里的password是你设置的密码)

修改密码验证插件,同时修改密码。

之后使用root ,3306端口,localhost,就可以登录MySQL了。

猜你喜欢

转载自blog.csdn.net/qq_36949176/article/details/86037856
今日推荐