MySQL 8.0.19 installation tutorial

There are many online installation tutorials, which are basically the same and the same. During the installation process...

There are many online installation tutorials, which are basically the same and the same. During the installation process, the installation may fail due to small details. I also refer to many installation tutorials to install successfully. During the installation process, there will be a variety of problems. We will find out the answers according to these problems and improve our ability to solve problems. It took us a day .
Installation environment: windows10
1. Download the zip installation package at https://dev.mysql.com/downloads/mysql/
Click this version to install, and then select "No thanks,just start my download." at the bottom to download the installation package
2, installation
2.1 unzip the zip package to the installation directory
(I unzip it in C:\Program Files\Mysql\mysql-8.0.19-winx64)

2.2 configure environment variables
Right click computer - properties - advanced system settings - environment variables - new system variable

2.3 configure the initialized my.ini file
We found that there is no my.ini file in the extracted file, so we need to create it ourselves. Add my.ini (create a new text file, change the file type to INI) in the installation root directory, and write the basic configuration:

[mysqld] # Set 3306 port port=3306 # Set the installation directory of mysql basedir=C:\\Program Files\\Mysql\\mysql-8.0.19-winx64 # Set the storage directory of mysql database data datadir=C:\\Program Files\\Mysql\\mysql-8.0.19-winx64\\data # Maximum connections allowed max_connections=200 # The number of connection failures allowed. This is to prevent someone from trying to attack the database system from the host max_connect_errors=10 # The character set used by the server defaults to UTF8 character-set-server=utf8 # Default storage engine to use when creating new tables default-storage-engine=INNODB # Use "MySQL native password" plug-in authentication by default default_authentication_plugin=mysql_native_password [mysql] # Set mysql client default character set default-character-set=utf8 [client] # Set the default port when mysql client connects to the server port=3306 default-character-set=utf8


3. Install MySQL
During the installation process, cmd must be run as an administrator, otherwise an error will be reported during the installation process, causing the installation to fail.
3.1 initialize database
Execute the command in the bin directory of MySQL installation directory:

mysqld --initialize --console

After execution, the initial default password of root will be printed out, such as:

C:\Users\Administrator>cd C:\Program Files\Mysql\mysql-8.0.19-winx64\bin C:\Program Files\Mysql\mysql-8.0.19-winx64\bin>mysqld --initialize --console 2018-04-28T15:57:17.087519Z 0 [System] [MY-013169] [Server] C:\Program Files\MySQL\bin\mysqld.exe (mysqld 8.0.11) initializing of server in progress as process 4984 2018-04-28T15:57:24.859249Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: rI5rvf5x5G,E 2018-04-28T15:57:27.106660Z 0 [System] [MY-013170] [Server] C:\Program Files\MySQL\bin\mysqld.exe (mysqld 8.0.11) initializing of server has completed C:\Program Files\Mysql\mysql-8.0.19-winx64\bin>

Be careful! There is a section in the execution output: [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: rI5rvf5x5G,E is the initial password (excluding the first space). Before changing the password, you need to remember the password, which is needed for subsequent login.
If you shut it down or don't remember, it's OK. Delete the initialized datadir directory, execute the initialization command again, and it will be regenerated. Of course, you can also use security tools to force password changes. You can use whatever method you like.
Reference: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization-mysqld.html
3.2 installation services
Execute the command in the bin directory of MySQL installation directory:
mysqld --install service name
The following service name can be left blank. The default name is mysql. Of course, if you need to install multiple MySQL services on your computer, you can distinguish them by different names, such as mysql3 and mysql5
After installation, you can start MySQL service with the command net start mysql. In addition, you can stop MySQL service with the command net stop mysql and uninstall MySQL service with the command SC delete MySQL / mysqld remove.

4. Change password
Execute the command in the bin directory where MySQL is installed:
mysql -u root -p
At this time, you will be prompted to enter the password. Remember the initial password in step 3.1 installation. After filling in, you will be successfully logged in and enter MYSQL command mode.

To execute a command in MySQL:
ALTER USER 'root' @ 'localhost' identified with MySQL 'native' password by 'new password';

Change the password, pay attention to the end of the command; be sure to have, this is the syntax of mysql

At this point, the installation and deployment of MySQL is completed.
You can view the default installed database with the command:
show datebases;
use mysql;
show tables;

mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec) mysql>
More love Published 3 original articles, won praise 1, visited 79 Private letter follow

7 February 2020, 07:19 | Views: 2444

Add new comment

For adding a comment, please log in
or create account

0 comments