windows下mysql压缩版安装

下载

有安装和免安装版,这里选择压缩文件版,安装版安一堆东西太麻烦了。下载完后解压放到某个位置。这里使用5.7.10版本。

配置

如果是压缩版的mysql需要配置,如果是setup安装的,则在安装过程中就已经配置好了。官方配置教程说明。

1 添加环境变量

将mysql的bin目录添加到环境变量中。

2 复制ini

my-default.ini复制为my.ini

3 修改配置

default-character-set=utf8 
basedir= E:\mysql-5.6.26-winx64(mysql所在目录) 
datadir= E:\mysql-5.6.26-winx64\data (mysql所在目录\data)
[mysqld]
port = 3306

4 初始化数据库

管理员身份运行cmd,输入如下命令回车:
mysqld --initialize --user=mysql --console
控制台输出:注意最后一行是生成的密码,记下来第一次登录需要使用

2016-04-26T09:16:33.925375Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is
 deprecated. Please use --explicit_defaults_for_timestamp server option (see doc
umentation for more details).
2016-04-26T09:16:33.925375Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'E
RROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will
be merged with strict mode in a future release.
2016-04-26T09:16:33.925375Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not s
et.
2016-04-26T09:16:36.589365Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-04-26T09:16:37.007557Z 0 [Warning] InnoDB: Creating foreign key constraint
system tables.
2016-04-26T09:16:37.222293Z 0 [Warning] No existing UUID has been found, so we a
ssume that this is the first time that this server has been started. Generating
a new UUID: 93f9a76c-0b8f-11e6-a04d-408d5c907f1b.
2016-04-26T09:16:37.318877Z 0 [Warning] Gtid table is not ready to be used. Tabl
e 'mysql.gtid_executed' cannot be opened.
2016-04-26T09:16:37.382955Z 1 [Note] A temporary password is generated for root@
localhost: yzkw7X)#Z&sT

cmd管理员身份打开,不然又权限错误

5 添加mysql服务到系统服务

mysqld --install MySQL

6 启动服务

net start mysql

7 修改密码

使用刚生成的密码连接上数据库,第一次使用提示要重新设置密码:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo
re executing this statement.

在mysql命令行使用命令修改密码:
set password for root@localhost = password('123456');
安装成功啦!

8 删除mysql

  1. 删除mysql服务:
  2. 以管理员身份运行命令提示符,然后输入sc delete mysql
  3. 关闭运行中的mysql进程
  4. 删除整个mysql文件夹

猜你喜欢

转载自www.cnblogs.com/for-you/p/8940614.html
今日推荐