当前位置: 移动技术网 > IT编程>数据库>Mysql > 2017最新版windows安装mysql教程

2017最新版windows安装mysql教程

2017年12月07日  | 移动技术网IT编程  | 我要评论

佐将胶囊,逆爱2后会无期,running man100801

1.首先在mysql官网下载最新版mysql, 附上链接点击打开链接,根据你的系统型号选择对应的包下载,大约300多兆,版本号为5.7.19

下载完之后,解压缩,是一个标准的mysql文件,如图

2.第二步,配置系统环境变量,桌面→我的电脑→右键"属性"→高级系统设置→环境变量→系统变量→新建

变量名可以根据喜好随便取,我这里叫做mysql_home,变量值是你刚刚下载的mysql文件夹所在的目录,我们指向其中的bin目录,然后一路确定返回

3.我们的mysql文件中没有默认的配置文件,我们新建一个.ini的配置文件,名字为my-default.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:\mysql-server
# datadir = d:\mysql-server\data
# port = .....
# server_id = .....
#设置服务器字符集为utf8
character_set_server=utf8
collation-server=utf8_general_ci
#设置mysql的安装目录
basedir = d:\mysql-server
#设置mysql的数据文件存放目录
datadir = d:\mysql-server\data
#设置mysql服务所绑定的端口
port = 3306
#设置mysql允许的最大连接数
max_connections=15
# 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 
[client]  
#设置客户端字符集
default-character-set=utf8
[winmysqladmin]
server = d:\mysql-server\bin\mysqld.exe
sql_mode=no_engine_substitution,strict_trans_tables 

注意里面的几个路径,一定要修改为你的mysql文件夹所在的路径,由于我放的目录是d:\mysql-server,所以上面的配置路径都为这个

4.准备安装mysql,通过命令行工具安装

   首先以管理员身份启动cmd             !!!注意!!!,一定要以管理员身份启动,否则后面会报错,提示权限不够

   命令如下:  mysqld -install  如果出现以下提示,说明安装成功

  然后开始启动服务,命令: net start mysql

    这时候报错了,提示无法启动,3534 ,我们通过 mysqld --console命令来查看错误日志

     这里提示,mysql文件夹下没有\data这个文件或者路径,这时我们新建一个

     我们用命令进入到mysql文件夹的路径,输入以下命令:

  mysqld --initialize-insecure --user=mysql

     执行完上面命令后,mysql会自建一个data文件夹,并且建好默认数据库,登录的用户名为root,密码为空

     这时我们再重新启动mysql,发现就能正常启动了

    至此.我们安装mysql就成功了

总结

以上所述是小编给大家介绍的2017最新版windows安装mysql教程,希望对大家有所帮助

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网