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

MySQL:MySQL5.7.21安装教程

程序员文章站 2024-03-18 10:08:40
...

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根目录
  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. 通过“mysql -uroot -P3306 -p”启动MySQL。

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

MySQL:MySQL5.7.21安装教程

  1. 即可。
相关标签: MySQL