参考官方文档
http://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html
2.3.5.1 Extracting the Install Archive
下载路径:http://dev.mysql.com/downloads/mysql/
解压到自定义路径,如D:\Program Files\mysql-5.7.12-winx64
2.3.5.2 Creating an Option File
新建data文件夹,路径如下:D:\Program Files\mysql-5.7.12-winx64\data(若不想用data而是mydata详见官方文档)
D:\Program Files\mysql-5.7.12-winx64目录下新建my.ini文件(或直接修改my-default.ini):
[mysqld]
basedir = D:\Program Files\mysql-5.7.12-winx64
datadir = D:\Program Files\mysql-5.7.12-winx64\data
port = 3306
在系统变量中配置
MYSQL_HOME=D:\Program Files\mysql-5.7.12-winx64;
path新增%MYSQL_HOME%\bin;
以管理员身份运行cmd(一定要用管理员身份运行,不然权限不够),
输入:cd C:\Program Files\MySQL\MyServer.aspx' >SQL Server 5.6\bin 进入mysql的bin文件夹(不管有没有配置过环境变量,也要进入bin文件夹,否则之后启动服务仍然会报错误2)
输入mysqld -install(如果不用管理员身份运行,将会因为权限不够而出现错误:Install/Remove of the Service Denied!)
2.3.5.3 Selecting a MySQL Server Type
略(可直接跳过)
2.3.5.4 Initializing the Data Directory
On Windows, use one of these commands:
C:\> bin\mysqld --initialize(产生随机密码,自己保存随机密码后自行修改)
C:\> bin\mysqld --initialize-insecure(不产生密码)
本文主要介绍第二种
2.3.5.5 Starting the Server for the First Time
mysqld --console可以打印相关控制台日志
启动数据库输入 net start mysql
连接数据库:
if you used --initialize-insecure
to initialize the data directory, connect to the server as root
without a password:
mysql -u root --skip-password
连上后修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password(自定义)'
;
2.3.5.6 Starting MySQL from the Windows Command Line
2.3.5.7 Customizing the PATH for MySQL Tools
2.3.5.8 Starting MySQL as a Windows Service
2.3.5.9 Testing The MySQL Installation
原标题:MySQL 5.7 Zip 安装(win7)
关键词:MYSQL