Winwods 安装 MySQL-8.0.16

1 环境信息

OS:Windows7
MySQL:社区版8.0.16

1 在mysql文件夹下新建my.ini文件和data文件夹

配置文件my.ini

[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
 
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=D:\Program Files (x86)\mysql-8.0.16-winx64
# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
# datadir=C:\\web\\sqldata
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

2 初始化

  • 1 以管理员的身份打开cmd窗口跳转路径到D:\Program Files (x86)\mysql-8.0.16-winx64\bin
  • 2 初始化命令mysqld --initialize --user=mysql --console
D:\Program Files (x86)\mysql-8.0.16-winx64\bin>mysqld --initialize --user=mysql --console
2019-06-12T22:29:56.740810Z 0 [System] [MY-013169] [Server] D:\Program Files (x86)
\mysql-8.0.16-winx64\bin\mysqld.exe (mysqld 8.0.16) initializing of server in progress as 
process 2436
2019-06-12T22:29:56.756410Z 0 [ERROR] [MY-010457] [Server] --initialize specified but 
the data directory has files in it. Aborting.

3 添加服务

  • 输入mysqld -install进行服务的添加
D:\Program Files (x86)\mysql-8.0.16-winx64\bin>mysqld -install
The service already exists!
The current server installed: "D:\Program Files (x86)\mysql-8.0.16-winx64\bin\my
sqld" MySQL

4 启动服务

  • 输入net start mysql启动服务
D:\Program Files (x86)\mysql-8.0.16-winx64\bin>net start mysql
MySQL 服务正在启动 ...
MySQL 服务已经启动成功。

5 登录

  • 输入mysql -u root -p进行登录
D:\Program Files (x86)\mysql-8.0.16-winx64\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值