Win10 installs MySQL-8.0.16 database, detailed installation, and errors during installation

The latest mysql installation package is as follows

Link: https://pan.baidu.com/s/1Ry61T3NZlLWAs7bpiTKmLA Extraction code: figa 

After the installation package is decompressed, it is as follows: you can put it in other folders at will

 

After decompressing to C drive, there will be a file named C:\Program Files\mysql-8.0.16-winx64. Click to enter to view the subdirectories under this folder as follows:  

 

 The black cmd window is called up under the windows system, prompting it is best to open it as an administrator, and enter the subdirectory bin in the MYSQL installation directory just now in the command line mode, C:\Program Files\mysql-8.0.16-winx64\bin directory Below, as shown in the figure:

 

 Then enter the installation command mysqld -install in the C:\Program Files\mysql-8.0.16-winx64\bin directory. It is relatively simple and I will not take a screenshot. If there is an error, please open the black window as an administrator.

The execution will generate a data folder in the MYSQL decompression directory C:\Program Files\mysql-8.0.16-winx64, which contains a file ending with the suffix .err. This file contains the first time you use MYSQL A temporary random password is generated. Open this .err file with Notepad, you can find the random password, (root@localhost:'password')    2 You can also execute mysqld --initialize --console to  generate a random password, which will be printed to the console and saved in a place  

 Then configure the MYSQL startup file, create a new .ini format file my.ini under the MYSQL decompression directory C:\Program Files\mysql-8.0.16-winx64, and then open it in Notepad format and write the following code: just copy paste save note down your path to change

[mysqld]
# Set 3306 port
port=3306
# Set mysql installation directory
basedir=C:\Program Files\mysql-8.0.16-winx64
# Storage directory of database data (Do not create this Data directory manually, otherwise an error will be reported )
datadir=C:\Program Files\mysql-8.0.16-winx64\Data
# Allow the maximum number of connections
max_connections=200
# Allow the number of connection failures. This is to prevent someone from attempting to attack the database system from this host
max_connect_errors=10
# The character set used by the
server is UTF8 by default character-set-server=utf8
# The default storage engine that will be used when creating a new table
default-storage-engine=INNODB
# Use "mysql_native_password" plug-in authentication by default
default_authentication_plugin=mysql_native_password
[mysql]
# Set the default character set of the mysql client
default-character-set=utf8
[client]
# Set the port used by default when the mysql client connects to the server
port=3306
default-character-set=utf8

Then enter the following command in the bin directory: 

mysqld -install service name (custom, you can use mysql8, mysql)

Start the service:

net start mysql

Log in to MySQL: The password is the random password above

mysql -u root -p

1 Modify password: 1 Useful if not used 2, choose one of the two (only 2 is available for the new version)

set password for root@localhost=password('密码');  

2 Modify password:

alter user 'root'@'localhost' identified by '密码';

 Finally configure environment variables

 

Guess you like

Origin blog.csdn.net/weixin_43407092/article/details/89743502
Recommended