MySQL安装记录

背景

Windows系统重装了, 想恢复一下之前的MySQL环境, 而且本地数据库也是比较常用的, 刚好本次也在安装, 做一个简单的记录. 也算是自己的学习记录输出. 遇到的问题当然也可以同时记录在这里, 方便后
续回顾.

资料包

百度网盘

// TODO 估计放了也会被CSDN屏蔽, 这里就不放了, 后续如果有好的共享磁盘工具, 再分享. 百度网盘也是垃圾, 限速狗. 

下载地址

这里直接给下载源头地址(不太清楚是否需要科学上网):

MySQL官网: https://www.mysql.com
MySQL安装记录_第1张图片

下载地址: https://dev.mysql.com/downloads/installer
我选得是这个:
MySQL安装记录_第2张图片

安装

步骤一: Type and Networking

感觉都是一些简单的配置, 截图如下:
MySQL安装记录_第3张图片

步骤二: Authentication Method

我也是选择默认配置:
MySQL安装记录_第4张图片

步骤三: Accounts and Roles

设置一个密码, 我的是: 1一排2一排逗句, 反正也没人看懂, 哈哈
MySQL安装记录_第5张图片

步骤四: Windows Service

我是直接默认下一步:
MySQL安装记录_第6张图片

步骤五: Service File Permissions

这个目录不知道为啥不能修改, 有点坑啊
MySQL安装记录_第7张图片

步骤六: Logging Options

我这里好像是之前选了高级配置, 才有这个选项.

这里我仔细配置了一下日志目录, 方便更加深入的了解MySQL, 不能简单的为了安装一个软件而安装件, 最好是可以学习到有点东西, 毕竟也花费了一点时间.
MySQL安装记录_第8张图片

步骤七: Advanced Options

MySQL安装记录_第9张图片

步骤八: Apply Configuration

开始配置了:
MySQL安装记录_第10张图片
很快就安装完成了:
MySQL安装记录_第11张图片

执行日志(参考)

Beginning configuration step: Writing configuration file

Saving my.ini configuration file...
Saved my.ini configuration file.
Ended configuration step: Writing configuration file

Beginning configuration step: Updating Windows Firewall rules

Adding a Windows Firewall rule for MySQL80 on port 3306.
Attempting to add a Windows Firewall rule with command: netsh.exe advfirewall firewall add rule name="Port 3306" protocol=TCP localport=3306 dir=in action=allow
确定。


Successfully added the Windows Firewall rule.
Adding a Windows Firewall rule for MySQL80 on port 33060.
Attempting to add a Windows Firewall rule with command: netsh.exe advfirewall firewall add rule name="Port 33060" protocol=TCP localport=33060 dir=in action=allow
确定。


Successfully added the Windows Firewall rule.
Ended configuration step: Updating Windows Firewall rules

Beginning configuration step: Adjusting Windows service

Attempting to grant the required filesystem permissions to the 'NT AUTHORITY\NetworkService' account.
Granted permissions to the data directory.
Granted permissions to access the 'E:\21-MySQL\01-ErrorLogs\zhengbizhong.err' log file.
Granted permissions to access the 'E:\21-MySQL\02-GeneralLog\zhengbizhong.log' log file.
Granted permissions to access the 'E:\21-MySQL\03-SlowQueryLog\zhengbizhong-slow.log' log file.
Granted permissions to access the 'E:\21-MySQL\04-BinaryLog\zhengbizhong-bin' log file.
Adding new service
New service added
Ended configuration step: Adjusting Windows service

Beginning configuration step: Initializing database (may take a long time)

Attempting to run MySQL Server with --initialize-insecure option...
Starting process for MySQL Server 8.0.34...
Starting process with command: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console --initialize-insecure=on --lower-case-table-names=1...
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.34) initializing of server in progress as process 8508
InnoDB initialization has started.
InnoDB initialization has ended.
root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
Process for mysqld, with ID 8508, was run successfully and exited with code 0.
Successfully started process for MySQL Server 8.0.34.
MySQL Server 8.0.34 intialized the database successfully.
Ended configuration step: Initializing database (may take a long time)

Beginning configuration step: Updating permissions for the data folder and related server files

Attempting to update the permissions for the data folder and related server files...
Inherited permissions have been converted to explicit permissions.
Full control permissions granted to: NETWORK SERVICE.
Full control permissions granted to: Administrators.
Full control permissions granted to: CREATOR OWNER.
Full control permissions granted to: SYSTEM.
Access to the data directory is removed for the users group.
Permissions for the data folder and related server files are updated correctly.
Ended configuration step: Updating permissions for the data folder and related server files

Beginning configuration step: Starting the server

Attempting to start service MySQL80...
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.34) starting as process 3616
InnoDB initialization has started.
InnoDB initialization has ended.
CA certificate ca.pem is self signed.
Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
X Plugin ready for connections. Bind-address: '::' port: 33060
C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.34'  socket: ''  port: 3306  MySQL Community Server - GPL.
Successfully started service MySQL80.
Waiting until a connection to MySQL Server 8.0.34 can be established (with a maximum of 10 attempts)...
Retry 1: Attempting to connect to Mysql@localhost:3306 with user root with no password...
Successfully connected to MySQL Server 8.0.34.
Ended configuration step: Starting the server

Beginning configuration step: Applying security settings

Attempting to update security settings.
Updated security settings.
Ended configuration step: Applying security settings

Beginning configuration step: Updating the Start menu link

Attempting to verify command-line client shortcut.
Verified command-line client shortcut.
Verified command-line client shortcut.
Ended configuration step: Updating the Start menu link

本地连接

可以看到本地已经安装完成, 截图如下:
MySQL安装记录_第12张图片

Navicat连接活DG(JetBrains 团队出品的)连接

新建数据库

问题汇总

问题1: 选择安装包的时候, 有一个32bit是什么意思呢?

MySQL安装记录_第13张图片

问题2: MSI Installer是一个什么安装方式呢?

MySQL安装记录_第14张图片

(已处理)问题3: mysql 不是内部命令

配置环境变量就行. 这里不多赘述了.

解决方案:

把这个目录配置进去, 我是这个目录: C:\Program Files\MySQL\MySQL Server 8.0\bin
MySQL安装记录_第15张图片

(已处理)问题4: 报错了登录不上去

问题截图:

MySQL安装记录_第16张图片

原因分析

命令记错了.

处理方案:

mysqld命令是MySQL的主程序,用来安装初始化;mysql是MySQL的命令行工具;这里因为命令敲成了mysqld -u root -p导致的,正确的命令应该是mysql -uroot -p

你可能感兴趣的:(基础学习,mysql,数据库)