Steps to install MySQL on Windows using a compressed archive file

Steps to install MySQL on Windows using a compressed archive file

Recently, I need to do a small verification experiment and install MySQL. I searched online and found many tutorials and many bugs, so I translated the process from the official website directly. Please note that it is a compressed file, not an installation version. It can be used directly after decompression. I will paste the process directly below:

Installing MySQL on Windows Using a Compressed Archive

1. Extract the files to the installation directory

1) Administrator privileges
2) Select the installation location, the default is C:\mysql, and the installation location is set through the configuration file
3) Use the software to decompress. If a main directory is generated by default, please put the sub-files in the main directory to the installation location you specified.

2. Create a configuration file

A. Why use configuration files

1) Installation and data directories are different from the default locations
2) You need to customize the server settings

B. File location and name

1) When Windows starts the MySQL service, it looks for configuration files in several places, Windows directory/MySQL
2) File name my.ini/my.cnf, to avoid conflicts, use one of them
3) Make sure the MySQL server user can read the my.ini file

C. File Format

 [mysqld]
    # set basedir to your installation path
    basedir=E:/mysql
    # set datadir to the location of your data directory
    datadir=E:/mydata/data

D. Initialize the location of related files

Initialize MySQL to generate related files

E. Change directory

Move the original data + --datadir command line option each time you start the service

3. Select MySQL server type

1)mysqld: named-pipe support
2)mysqld-debug: automatic memory allocation check

Support the same storage engine. When using named pipe, be sure to close the named pipe when closing it.

4. Initialize MySQL (using mysqld)

Assume that your current directory is %BASEDIR% in the configuration file, which is the MySQL installation directory.

A. Initialize the data directory

1) bin\mysqld --initialize: contains an expired password and requires you to choose a new password
2) bin\mysqld --initialize-insecure: No root password is generated, assuming you assign a password before using the service
3) If MySQL cannot locate the exact installation directory and data storage directory

(1) Command line: bin/mysqld --default-file=C:\my.ini --initialize
(2) Configuration file as shown in 2.C.

B. Specific behavior sequence when calling the --initialize/--initialize-insecure option

1) The service checks whether the data directory exists. If it does not exist, create it. If it does exist, report an error.
2) In the data storage directory, the server creates the MySQL system database and table
3) Initialize system tables, InnoDB tables, etc.
4) The server creates a 'root'@'localhost' superuser and other saved users You should create keys for the superuser
(1) Using the --initialize option, the server generates a random key and marks it as expired, generating a warning
(2) Use --initialize-insecure to not generate a password
5) If possible, the server generates server-side auxiliary tables and files
6) If the --init-file option is used and the file contains SQL statements, the server executes the statements in the file
7) Exit the server

5. Start MySQL Server

MySQL supports named-pipe/TCP/shared memory communication
A. Start the server command: %basedir%\bin\mysqld" --console
B. Start the service: %basedir%\bin\mysqld
C. Shut down the service:%basedir%\bin\mysqld -u root -p (for password)shutdown

6. Account security settings

When you successfully initialize, start the MySQL service normally, and log in to the database, assign a new password to 'root'@'localhost'

A. Start the server, as in 5.
B. Connect to the server:

1) Use --initialize to initialize the directory: Connect to the database as root and log in using the password generated by the server. If you don't know the password, check the error log
shell> myslq -u root -p
Enter passworld: (Enter the generated password)

2) If you use --initialize-insecure:

shell>mysql -u root --skip-password

C. After the connection is successful, assign a new password to root
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

Note:

1) The configuration file is encoded in ANSI

2) The above method requires opening two windows with the command line, one to run the start service command to indicate the server process, and then enter the login command in the other window to log in to the database

3) After entering, all the inputs are SQL statements, which need to be terminated with a semicolon. You need to set and change the root password after the first login

4) Since I didn't encounter any bugs in the configuration, if you encounter a bug, you can Baidu error code/check the official website error code table

Summarize

The above are the steps I introduced to you to install MySQL using compressed archive files on Windows systems. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • MySQL data archiving tool mysql_archiver detailed explanation

<<:  How to set static IP in centOS7 NET mode

>>:  How to determine if the Linux system is installed on VMware

Recommend

React error boundary component processing

This is the content of React 16. It is not the la...

Native JS to achieve image marquee effects

Today I will share with you a picture marquee eff...

Detailed explanation of Nginx process scheduling problem

Nginx uses a fixed number of multi-process models...

How to solve the problem of blurry small icons on mobile devices

Preface Previously, I talked about the problem of...

How to implement h5 input box prompt + normal text box prompt

XML/HTML CodeCopy content to clipboard < input...

MySQL 5.7.17 installation and configuration method graphic tutorial

This article shares the installation and configur...

K3s Getting Started Guide - Detailed Tutorial on Running K3s in Docker

What is k3d? k3d is a small program for running a...

How to implement blank space in Taobao with CSS3

Make a blank space for Taobao: When you shrink th...

Detailed steps to upgrade mysql8.0.11 to mysql8.0.17 under win2008

Upgrade background: In order to solve the vulnera...

How to convert MySQL horizontally to vertically and vertically to horizontally

Initialize Data DROP TABLE IF EXISTS `test_01`; C...

Detailed graphic and text instructions for installing MySQL 5.7.20 on Mac OS

Installing MySQL 5.7 from TAR.GZ on Mac OS X Comp...

JavaScript implements front-end countdown effect

This article shares the specific code of JavaScri...

Tutorial on using prepare, execute and deallocate statements in MySQL

Preface MySQL officially refers to prepare, execu...