mysql-8.0.18-winx64 installation environment win10

Mysql download the installation package, then extract to a directory you want to install, I downloaded the mysql-8.0.18-winx64

Installing MySQL on Windows will be relatively simple, the latest version is available in  MySQL download  download View in

 

 Point Download this download, go to the download page, please click on the graph  No thanks, just start my download.  You can download

 

 Downloading the installation package extract to a directory you want to install, and I put it in  C: \ Web \ mysql-8.0.18

Place the installation package, we get to give the MySQL configuration file

Just open the C: \ Web \ mysql-8.0.18 created in this file my.ini configuration file, edit the configuration file information is as follows (entirely without foundation may not know how to get this .ini, described here below: create one. txt file, written after the changed configuration .txt .ini):

[client]
#设置Mysql客户端默认字符集
default-character-set=utf-8

[mysql]
#设置3306端口
port = 3306
#设置MYSQL的安装目录
basedir=C:\\Web\\mysql-8.0.18
#允许最大连接数
max_connections=20
#服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server = utf-8
创建新表时将使用默认存储引擎
default-storage-INNODB

配置文件完成,我们来启动MySQL

以管理员身份打开cmd 命令行工具,切换目录:

cd C:\Web\mysql-8.0.18\bin

初始化数据库

mysqld --initialize --console

执行完后,会输出root初始密码如下:

 root@localhost: os<Usg+=D0uj(这个就是初始密码请一定记住)

C:\Web\mysql-8.0.18\bin>mysqld --initialize --console
2019-12-28T03:19:10.967657Z 0 [System] [MY-013169] [Server] C:\Web\mysql-8.0.18\bin\mysqld.exe (mysqld 8.0.18) initializing of server in progress as process 17424
2019-12-28T03:19:12.549335Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: os<Usg+=D0uj

      注意:

      在执行:mysqld --initialize --console

      此处可能出现的报错:.....MySQL Community Server - GPL(如下图)

    

 

          解决办法:打开目录下的mysql文件夹 ,将已经存在的data目录删除,再将上面的代码执行一遍即可

 

再输入安装命令:

mysqld install

安装成功出现如下提示:

Service successfully installed
C:\Web\mysql-8.0.18\bin>mysqld install
Service successfully installed.

    注意:

        在mysql的bin目录下面执行: mysqld --install

        此处可能出现的报错:Install/Remove of the Service Denied

       解决办法:打开cmd.exe程序的时候选择“用管理员身份打开”

      用管理员身份打开cmd.exe程序方法:点击电脑win键打开菜单------>在菜单中找到  Windows系统  ------>展开   Windows系统   找到   命令提示符  ----->右键 更多  再选择  以管理员身份运行   即可

 

启动输入以下命令:

net start mysql

成功启动提示如下:

C:\Web\mysql-8.0.18\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

 登录 MySQL

当 MySQL 服务已经运行时, 我们可以通过 MySQL 自带的客户端工具登录到 MySQL 数据库中, 首先打开命令提示符, 输入以下格式的命名:

mysql -h 主机名 -u 用户名 -p

参数说明:

-h : 指定客户端所要登录的 MySQL 主机名, 登录本机(localhost 或 127.0.0.1)该参数可以省略;
-u : 登录的用户名;
-p : 告诉服务器将会使用一个密码来登录, 如果所要登录的用户名密码为空, 可以忽略此选项。

我们要登录本机的 MySQL 数据库,只需要输入以下命令即可:

mysql -u root -p

回车确认, 如果安装正确且 MySQL 正在运行, 会得到以下结果:

Enter password:

此时如存在密码(我在此处用的密码就是上面标记的那个厨师密码),输入密码登录,如不存在直接回车。

登录成功后你将会看到 Welcome to the MySQL monitor... 的提示语

然后命令提示符会一直以 mysq> 加一个闪烁的光标等待命令的输入, 输入 exit 或 quit 退出登录。

 

特别申明:此篇文章仅是结合自己的实际操作所写,是作为初学者学习的一个过程记录。

Guess you like

Origin www.cnblogs.com/mariaJustin/p/12111084.html