本文记录了mysql 5.7.21安装配置方法,具体内容如下
1.下载
下载地址
解压到自己喜欢的一个位置即可(目录中不要包含中文)
如:D:/Program Files/
2.系统环境变量配置
(1)新增系统变量
变量名:MYSQL_HOME
变量值:Mysql解压目录,如D:/Program Files/mysql-5.7.21-winx64
(2)追加PATH
;%MYSQL_HOME%/bin;
3.配置my.ini文件
在解压根目录新建一个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_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://Program Files/mysql-5.7.21-winx64" datadir = "D://Program Files/mysql-5.7.21-winx64/data" port = 3306 character_set_server = utf8 # 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 |
4.管理员方式启动命令提示窗符
进入mysql解压目录到bin目录下
如:D:/Program Files/mysql-5.7.21-winx64/bin
分别执行:
(1)初始化:mysqld -initialize-insecure
如果报错failed to set datadir to 则 执行一下 mysqld --initialize --user=mysql --console,再执行(1);
正确之后会在Mysql解压根目录生成data文件夹以及相关文件
(2)mysqld -install
*如提示Install/Remove of the Service Denied,说明不是已管理员的方式进入的命令提示符
(3)启动服务:net start mysql
新闻热点
疑难解答