mysql-8.0.18-winx64的安装

从官网下载
Mysql Server Community

下载完成之后解压,在目录下创建设置文件my.ini
在这里插入图片描述
设置内容如下:
(注意之前data文件夹不存在,最好自己创建data文件夹)


[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\\Program Files (x86)\\mysql-8.0.19-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\\Program Files (x86)\\mysql-8.0.19-winx64\\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4
# 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 

然后添加这个路径到系统环境变量:
在这里插入图片描述

以管理员身份打开命令提示符,切换到安装目录下的bin目录,输入初始化指令,

C:\WINDOWS\system32>d:

D:\>cd D:\Program Files (x86)\mysql-8.0.19-winx64\bin
D:\Program Files (x86)\mysql-8.0.19-winx64\bin>mysqld --initialize --console

这里提示系统错误,有依赖库没有安装,
在这里插入图片描述

在网上查找这个库下载下来,
微软常用运行库合集_2019.07.20_X64
然后把runtime那个选项勾上(全勾上比较省事儿。。),安装完成再次运行初始化指令,

D:\Program Files (x86)\mysql-8.0.19-winx64\bin>mysqld --initialize --console
2020-02-11T04:44:16.059600Z 0 [System] [MY-013169] [Server] D:\Program Files (x86)\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) iniCtializing of server in progress as process 3100
2020-02-11T04:44:33.250875Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: f5ih#iy!eBqS

D:\Program Files (x86)\mysql-8.0.19-winx64\bin>

成功之后,这里给出了一个初始密码,可以记录一下,
然后输入指令开始安装,

D:\Program Files (x86)\mysql-8.0.19-winx64\bin>mysqld --install
Service successfully installed.

安装成功,
输入指令启动,

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

D:\Program Files (x86)\mysql-8.0.19-winx64\bin>

输入指令登陆,

D:\Program Files (x86)\mysql-8.0.19-winx64\bin>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.19

Copyright (c) 2000, 2020, 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> set password=PASSWORD('123456');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PASSWORD('123456')' at line 1
mysql> ALTER USER root@localhost IDENTIFIED  BY '123456';
Query OK, 0 rows affected (0.34 sec)

检验一下是否修改成功,
先输入exit退出登录,然后输入指令再次登录

mysql> exit
Bye

D:\Program Files (x86)\mysql-8.0.19-winx64\bin>mysql -uroot -p
Enter password: *******

完成。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值