windows server 2012 R2部署遇到的问题:
1.mysql 解压版安装
1.配置环境变量 MYSQL_HOME为mysql的解压地址
2.path中加入%MYSQL_HOME%\bin
3.配置my.ini 修改data的路径和mysql的运行路径
# 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_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.
#default-character-set=utf8
#默认字符集
basedir= D:\\Program Files\\mysql-5.7.37-winx64
datadir= D:\\Program Files\\mysql-5.7.37-winx64\\data
#服务端字符集默认使用Utf-8
character-set-server=utf8
#端口号
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=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
[client]
default-character-set=utf8
4.管理员窗口通过 mysqld --install 命令安装服务
5.免安装版中不会自动创建数据库,因此我们需要手动创建 mysqld --initialize-insecure --user=mysql;
6.通过 net start mysql 启动服务
备注:这一步如果没有启动起来的话,删除data目录,重新执行上述命令,
输入 mysqld --remove mysql 卸载mysql 服务,然后重新安装服务。
指定的mysql启动的命令地址不对的话,通过命令行regedit 修改注册表。
use mysql;
update user set authentication_string=password("123456") where user="root";
2.数据库mysql安装时缺少msvcp120.dll文件
要安装2013的c++ vcredist_x64.exe
3.windows服务启动时缺少 framework3.5库
从windows server2012 R2官方镜像中拉出来sxs文件夹,在服务器中指定备用源。
备注:
show variables like '%zone%';
设置mysql的时区
set global time_zone='+8:00';