马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
win10安装mysql8
一、下载
从官网(传送门)下载zip文件放在安装位置,我放在D盘根目次了
地点: https://downloads.mysql.com/archives/community/
下载好之后解压,我的位置在 D:\mysql-8.0.34-winx64
二、修改设置
进入解压文件之后创建 my.ini文件 内容如下:
需要修改的位置basedir和datadir
datadir:数据库的数据的存放目次 我在安装目次创建了一个data,有其他需求的自己改
- [mysqld]
- # 设置3306端口
- port=3306
- # 设置mysql的安装目录
- basedir=D:\mysql-8.0.34-winx64
- # 设置mysql数据库的数据的存放目录
- datadir=D:\mysql-8.0.34-winx64\data
- # 允许最大连接数
- max_connections=200
- # 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
- max_connect_errors=10
- # 服务端使用的字符集默认为UTF8
- character-set-server=utf8
- # 创建新表时将使用的默认存储引擎
- default-storage-engine=INNODB
- # 默认使用“mysql_native_password”插件认证
- default_authentication_plugin=mysql_native_password
- [mysql]
- # 设置mysql客户端默认字符集
- default-character-set=utf8
- [client]
- # 设置mysql客户端连接服务端时默认使用的端口
- port=3306
- default-character-set=utf8
复制代码 三、安装
以管理员身份运行cmd
然后进入mysql安装目次下的bin文件夹(D:\mysql-8.0.34-winx64\bin)
1、输入:mysqld --initialize --console 下令初始化mysql
如果设置环境变量就没须要进入到bin目次了
- C:\WINDOWS\system32>D:
- D:\>cd D:\mysql-8.0.34-winx64\bin
- D:\mysql-8.0.34-winx64\bin>mysqld --initialize --console
- 2023-10-24T02:24:46.512711Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
- 2023-10-24T02:24:46.512743Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.34-winx64\bin\mysqld.exe (mysqld 8.0.34) initializing of server in progress as process 9292
- 2023-10-24T02:24:46.514743Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
- 2023-10-24T02:24:46.659221Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
- 2023-10-24T02:24:54.829085Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
- 2023-10-24T02:25:01.378161Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Qpf&Hqo2AwuY
- 2023-10-24T02:25:02.299377Z 6 [Warning] [MY-013360] [Server] Plugin mysql_native_password reported: ''mysql_native_password' is deprecated and will be removed in a future release. Please use caching_sha2_password instead'
- D:\mysql-8.0.34-winx64\bin>
复制代码 执行完 mysqld --initialize --console 下令后稍等一会 就会出现一个临时暗码 Qpf&Hqo2AwuY(备份一下,一会修改暗码需要用的一下)
[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Qpf&Hqo2AwuY
2、安装mysql服务
输入:mysqld --install 下令- D:\mysql-8.0.34-winx64\bin>mysqld --install
- Service successfully installed.
复制代码 3、启动MySQL服务
输入:net start mysql 下令- D:\mysql-8.0.34-winx64\bin>net start mysql
- MySQL 服务正在启动 ...
- MySQL 服务已经启动成功。
复制代码 4、进入mysql
输入:mysql -u root -p 下令,然后在输入刚刚天生的临时暗码- D:\mysql-8.0.34-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.34
- Copyright (c) 2000, 2023, Oracle and/or its affiliates.
- 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>
复制代码 5、修改暗码
输入:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';- mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
- Query OK, 0 rows affected (0.15 sec)
- mysql>
复制代码 到这安装就竣事了
记得设置一下环境变量!
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |