码迷,mamicode.com
首页 > 数据库 > 详细

window下安装mysql服务方法

时间:2020-03-09 13:16:09      阅读:72      评论:0      收藏:0      [点我收藏+]

标签:src   inno   highlight   perl   ogg   程序   安装   sql_mode   ram   

.1、下载社区版本的服务端

技术图片

 

 技术图片

 

 技术图片

 

 

2、将压缩文件解压到对应的目录

技术图片

 

3、配置环境变量

 技术图片

 

 

4、新建my.ini文件

解压包里是没有my-dafault.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.

[mysql]
#max_sp_recursion_depth=100
[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:\MySQL\mysql-5.6.24-win32.1432006610\mysql-5.6.24-win32
# datadir = D:\MySQL\mysql-5.6.24-win32.1432006610\mysql-5.6.24-win32\data
# port = .....
# 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=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
max_sp_recursion_depth = 100

  

5、mysql初始化

以管理员权限打开cmd命令窗口,切换到”F:\mysql-5.7.21-winx64\bin”路径下,输入指令:

mysqld --initialize --user=mysql --console

该命令会在mysql-5.7.21-winx64目录下创建data文件夹及初始数据库,生成root用户和临时密码,红色标注部分多留意。

技术图片

 

 

6、安装mysql服务

继续在窗口输入指令:

mysqld install MySQL --defaults-file="F:\mysql-5.7.21-winx64\my.ini"

路径是你my.ini文件的绝对路径,此时如果遇到错误没能安装成功,请用管理员身份运行cmd.exe程序再试,正确安装如下图:

技术图片

 

 

7、启动mysql服务

在命令行窗口继续输入:

net start mysql

启动成功,会出现下面的截图。如果服务一直处于启动中,说明上一步的操作有误,核实my.ini文件路径是否正确

技术图片

 

 

如需修改密码和配置远程连接,请参考我的安装mysql博客,博客链接https://www.cnblogs.com/mituxiaogaoyang/p/8655952.html

 

window下安装mysql服务方法

标签:src   inno   highlight   perl   ogg   程序   安装   sql_mode   ram   

原文地址:https://www.cnblogs.com/mituxiaogaoyang/p/12447966.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!