MySQL:MySQL5.7.21安装教程

MySQL5.7 64位 zip文件安装教程

  1. 到官网下载MySQL5.7.zip。
  2. 将解压后的bin目录添加到环境变量的Path中。
  3. 在MySQL根目录创建my.ini文件,文件内容为:
	# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# 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的缓存,可以根据实际情况调整大小,我这里采取默认值
  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.
  #mysql根目录:你的mysql安装目录
  basedir = G:\MySQL\mysql-5.7.27-winx64
  #数据存储目录
  datadir = G:\MySQL\mysql-5.7.27-winx64\data
  #端口号,默认为3306
  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 
  #配置一下服务端的字符集
  character_set_server=utf8mb4
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
#配置一下客户端的字符集
[client]   
default-character-set=utf8mb4
  1. 以管理员身份运行cmd,输入命令“mysqld --initialize-insecure --user=mysql”;该命令会在MySQL根目录下创建名为data的文件夹。

  2. mysqld –install MySQL5.7 # install后面是服务名, 这里以MySQL5.7作为mysql5.7的服务名。

  3. 通过“Cortana”打开“服务”。

  4. 找到MySQL5.7,并启动。

  5. 在cmd 输入 “mysql -uroot -P3306 -p”启动MySQL。

  6. password(密码)通过data文件夹下生成的后缀为.err的文件中找,

在这里插入图片描述
一般情况下,通过zip压缩包安装的mysql, root用户的密码为空,直接回车即可。
10. 即可。

发布了54 篇原创文章 · 获赞 4 · 访问量 3580

猜你喜欢

转载自blog.csdn.net/qq_40994260/article/details/103208775