mysql 8.0 安装教程

大憨熊 提交于 2020-10-08 04:25:12

官网下载

官方安装教程(win)

windows 压缩包方式安装

压缩包安装官方教程

官方步骤:

1. Extract the main archive to the desired install directory

解压安装包到自定义安装目录

2. Optional: also extract the debug-test archive if you plan to execute the MySQL benchmark and test suite

可选项:若想执行mysql基准和测试套件,可解压官网下载的调试测试包

3. Create an option file

创建可选配置文件:定义mysql服务器启动参数 完整配置
配置文件优先级:my.ini > my.cnf
配置文件放置目录:msyql 安装根目录即可

[mysqld]
#  mysql安装目录
# set basedir to your installation path
basedir=E:/mysql

# mysql数组目录
# set datadir to the location of your data directory 
datadir=E:/mydata/data

4. Choose a MySQL server type

mysqld: mysql正常工作模式
mysqld-debug: mysql 调试工作模式,可调试和自动内存分配检查,排查执行出错

5. Initialize MySQL

初始化mysql数据目录

mysql8.0 账户验证方式变更:mysql_native_password -> caching_sha2_password

数据初始化方式:

  • 安全,root账户密码随机生成,标识过期,控制台打印:mysqld --initialize --console
  • 不安全,root账户不指定密码:mysqld --initialize-insecure --console
安全模式:
2020-06-20T14:02:59.538460Z 0 [System] [MY-013169] [Server] C:\Application\mysql-8.0.20\bin\mysqld.exe (mysqld 8.0.20) initializing of server in progress as process 808
2020-06-20T14:02:59.634151Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-20T14:03:10.459155Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-20T14:03:23.438372Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: <uavdhtD2ul?

非安全模式:空密码警告手动指定root密码即可
2020-06-20T14:15:17.254891Z 0 [System] [MY-013169] [Server] C:\Application\mysql-8.0.20\bin\mysqld.exe (mysqld 8.0.20) initializing of server in progress as process 5564
2020-06-20T14:15:17.275132Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-06-20T14:15:30.200787Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-06-20T14:15:44.389432Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.


Root密码设置方式:

  • 非安全方式初始化:mysqladmin -uroot password <新密码>
  • 安全方式初始化:mysqladmin -uroot -p <控制台打印随机生成密码> password <新密码>
  • 通用设置方式:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY <新密码>

6. Start the MySQL server

启动mysql

  • 控制台直接输入:mysqld(阻塞执行)
  • 安装为windows服务,通过windows服务执行:mysqld --install <服务名> , net start <服务名>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!