Under Win10 installation MySQL8

Step One: Download the installation package

Step two: Extract

Note: extract to a directory name can not appear such as Chinese or spaces

Step Three: Configure

1. Create a new file and folder

In the extracted directory, new my.inifiles and datafolders, as shown:

data folder remains empty like, of the following my.iniconfiguration:

Extract the directory is the install directory, my directory is unpacked D:\mysql-8.0.18-winx64, so the following directories to the path prevail. When you configure. Simply change to the directory of your own on the line.

port=3306
# 设置mysql的安装目录
basedir=D:\\mysql-8.0.18-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\\mysql-8.0.18-winx64\\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8

2. Configure Environment Variables

This computer --- Properties - Advanced System Settings - Environment Variables - System Variables - New, variable name: MYSQL_HOMEvariable values: D:\mysql-8.0.18-winx64you in time with the value of the variable to your installation path (unzipped) based .

In the system variables to find Path, select 编辑, then 新建, will be %MYSQL_HOME%\bincopied into the environment variables to configure an end.

Command Line Configuration

Administrator, open cmd, and then navigate to D:\mysql-8.0.18-winx64\binthe next. If you do not know how to switch directories in cmd mode, please refer to the following chart:

1. Initialization

Remember to initialize, such as skip this step, the next 1067 error will occur, not been resolved.

command:mysqld --initialize --user=mysql --console

After initialization is complete, there will generate a temporary password, please remember it. Log in use for a while. At this point, then look just the new data folder, which is the database save directory, discovery has generated a lot of documents, which do not have control.

2. Install the mysql service

command: mysqld -install

3. Start mysql service

command:net start mysql

4. Log

command: mysql -uroot -p123456

123456 只是作为密码示例,具体值以自己刚生成的密码为准。-u和root之间可以有空格,-p和123456之间如果有空格,则必须另起一行重新输入密码。

以上步骤若皆顺利,则如下图所示:

上图是我从借鉴的文章中直接拷贝过来的,因为我的已经运行好了,所以我就没再重复运行命令。图中最后一步登录那儿,就是我上面刚说的重启一行输密码的情况。

5.修改密码

命令:ALTER USER root@localhost IDENTIFIED BY '123456';

同样,123456 只是密码示例,你可以根据自己的喜好进行更改密码。

如果你把密码忘了,请参考这篇文章 mysql8.0版本忘记root密码,若是还不行,请自行搜索相关教程。

参考文章:Windows10下安装MySQL8.0
文章来源:Win10下安装MySQL8

Guess you like

Origin www.cnblogs.com/ccav1/p/12149889.html