解压版mysql安装
mysql版本是5.6.37。使用这个版本的问题是5.7版本使用过程中有一点问题,另外,自己本地电脑上安装的就是5.6版本,所以,在服务器上安装使用同一个版本。
1.下载
mysql是开源软件,可以在官网进行下载
http://dev.mysql.com/downloads/mysql/
2.解压,设置环境变量path
在环境变量中添加,mysql的安装位置
C:\Program Files\mysql-5.6.37-winx64\bin
3.配置my-default.ini文件
有很多教程都是说在bin目录下新建一个ini文件,或者复制my-default.ini到bin目录下。经过本人自己测试,也可以直接修改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-5.6.37-winx64
datadir = D:\mysql-5.6.37-winx64\data
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=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
修改文件中内容如下面内容,按照你自己的设定。
basedir = D:\mysql-5.6.37-winx64
datadir = D:\mysql-5.6.37-winx64\data
port = 3306
4.命令行安装
- 管理员运行cmd
cd到mysql的bin目录下
cd C:\Program Files\MySQL\MySQL Server 5.6\bin
- 运行mysqld -install,出现success提示
- net start mysql,启动mysql服务
- mysql -uroot -p登录,直接回车就进入数据库了。
修改初始root密码SQL
UPDATA mysql.user SET password = PASSWORD('你的密码') WHERE user = 'root' AND host = 'localhost';
数据库配置完成了。