Under Windows10 mysql 8.0.12-extracting Installation configuration graphic tutorials

Installation Environment: window10 Home Edition, 64

Database: mysql8.0.12 64 Wei

Installation: mounting compressed

installation steps:

1, download the installation package

Mysql download from the official website

Click on the bottom of the "no thanks, just start my download." To start the download archive after successful download

 

NOTE: When installing the database, the login user must have administrator privileges.

2, the compression directory after decompression to be installed into the

After extracting the file structure shown in FIG:

 

From the unzipped document structure, we can see that there is no my.ini configuration file, where the need to create their own my.ini configuration file.

3, create a configuration file my.ini

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 数据库服务端配置项
[mysqld]
# 数据库路径
basedir=d:\\programs\\mysql\\mysql-8.0.12-winx64
# 数据路径
datadir=d:\\programs\\mysql\\data
# 端口号
port=3306
# 默认字符集
character - set -server=utf8mb4
# 存储引擎
default -storage-engine=innodb
 
# 客户端配置项
[mysql]
# 默认字符集
default - character - set =utf8mb4
 
# 连接客户端配置项
[client]
default - character - set =utf8mb4

After the profile is created, it can be the next step of installation.

4, using the operation instruction initializes mysql

Open the terminal to the next installation data bin directory path:

 

Input command in the terminal "mysqld -initialize -console", and press Enter to complete initialization:

 

NOTE: After initialization is completed, do not close the window, because this will generate root password, the figure "p = brffhdg4t5" i.e. a random password.

当然,还有一种初始化方式是不会产生随机密码的,但是也需要在正式使用数据库前设置密码,这个初始化指令为“mysqld –initialize-insecure –console”。当使用无随机密码初始化数据库时,首次登陆数据时需要使用“mysql -u root –skip-password”,即跳过密码验证方式登陆。

5、数据库服务安装

数据库初始化完成后,即可将数据注册成windows服务,这样就可以用服务的方式启动数据库了。 打开终端,进入到数据安装路径下的bin目录下,如步骤4的图1。

使用指令“mysqld –install”即可完成服务的安装:

 

注:在注册服务时,一定要使用管理员身份执行,否则安装服务时会被拒绝。

同时,也可以使用指令“mysqld –remove”来将注册的服务给移除。

事实上,注册服务的完整指令是“mysqld –install 服务名”,若是服务名不写则默认为“mysql”,服务移除指令同样是“mysqld –remove 服务名”,默认值为“mysql”。

6、服务启动

在终端中使用指令“net start mysql”,即可启动数据库服务:

 

验证服务是否已经启动,在终端页面尝试能否登陆数据库,这里需要输入的密码即是在步骤4图2中初始化时系统生成的随机密码,输入即可:

 

登陆成功!在执行指令前,系统会强制要求更改初始化时的随机密码:

 

使用指令“alter user ‘root'@'localhost' identified by ‘my_new_psd';”,按回车键即可:

 

修改完密码后,就可以正常使用数据库啦!

 

使用客户端工具连接数据库:


Guess you like

Origin blog.51cto.com/14354846/2408221