windows下安装解压版mysql

1、下载mysql,选择Windows (x86, 64-bit), ZIP Archive

网址:https://dev.mysql.com/downloads/mysql/5.7.html

2、在D:\hospital_w42\tools\文件夹下创建一个mysql文件夹

3、在D:\hospital_w42\tools\mysql文件夹下创建my.ini文件,并写入以下内容

4、初始化mysql数据库

(1)cd D:\hospital_w42\tools\mysql\bin

(2)mysqld --defaults-file=D:\hospital_w42\tools\mysql\my.ini --initialize –console


5、安装mysql服务

mysqld --install mysql_hw42 --defaults-file="D:\hospital_w42\tools\mysql\my.ini"

6、启动mysql服务

net start mysql

7、创建hospital_w42数据库和hw用户

(1)登录mysql并输入临时密码

mysql -uroot -p -P3307

(2)修改root密码

set password for root@localhost = password('root');

(3)创建hospital_w42数据库:

CREATE DATABASE IF NOT EXISTS hospital_w42 default charset utf8 COLLATE utf8_general_ci;

(4)创建hw用户:

CREATE USER 'hw'@'%' IDENTIFIED BY '1qaz!QAZ';

(5)赋权给用户hw:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, CREATE VIEW, SHOW VIEW ON `hospital_w42`.* TO 'hw'@'%';

你可能感兴趣的:(windows下安装解压版mysql)