当前位置:Gxlcms > 数据库问题 > window下安装mysql服务方法

window下安装mysql服务方法

时间:2021-07-01 10:21:17 帮助过:12人阅读

.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   

人气教程排行