MySQL8.0 manual installation

First of all, let's talk about the daily life with you. With the rapid update of MySQL, MySQL has made rapid progress to version 8.0, so what is the obvious difference between it and the version 5.X we used before?

First, let's take a look at the query speed of MySQL 5.X's own table

Then offer the query speed of MySQL8.0's own table

The result is obvious, I have gone all over the pit of MySQL 8.0. In order to avoid detours, I offer the following manual installation method

1. Download and unzip the official website.

I downloaded mysql-8.0.11-winx64

2. Set system environment variables.

This is not to say a lot on Baidu, this is just for the convenience of the command line...

3. Write the configuration file.

Manually create the my.ini file in the root directory

[mysql]
; 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld] ;设置3306端口 port = 3306 ; 设置mysql的安装目录 basedir=C:\Program Files (x86)\mysql-5.7.16-win32 ; 设置mysql数据库的数据的存放目录 datadir=C:\Program Files (x86)\mysql-5.7.16-win32\data ; 允许最大连接数 max_connections=200 ; 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 ; 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB

Pay attention to modify the installation directory and data storage directory

4. Database initialization

The root user is automatically generated, without a password:

mysqld --initialize-insecure

Or with a random password:

mysqld --initialize

The random password is saved in the error log, located in the data folder (previously configured datadir), the file name is: hostname.err

Note: If you want to reinitialize, you must first empty the data folder. (including stopping the next service)

The tutorials I read do not have this step, resulting in:

服务无法启动。
服务器没有报告任何错误。
请键入 NET HELPMSG 3534 以获得更多的帮助。

5. Install and start the service

Execute on the command line.
install service:

mysqld -install

Start the service:

net start mysql

Back when it's time to go back.
Stop and uninstall the service:

net stop mysql
mysqld -remove

6. Enter MySQL

To enter without a password:

mysql -u root

Access with password:

mysql -u root -p

If you have a password, you will be asked to enter it. The location of the random password is mentioned above.

Impressed, I finally saw:

mysql> 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325006776&siteId=291194637