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

Example analysis of MySQL startup and connection methods

Table of contents How to start mysqld Method 1: m...

How to change mysql password under Centos

1. Modify MySQL login settings: # vim /etc/my.cnf...

Linux centOS installation JDK and Tomcat tutorial

First download JDK. Here we use jdk-8u181-linux-x...

Some tips for using less in Vue projects

Table of contents Preface 1. Style penetration 1....

MySQL Installer 8.0.21 installation tutorial with pictures and text

1. Reason I just needed to reinstall MySQL on a n...

Docker View Process, Memory, and Cup Consumption

Docker view process, memory, cup consumption Star...

Summary of the understanding of virtual DOM in Vue

It is essentially a common js object used to desc...

The main differences between MySQL 4.1/5.0/5.1/5.5/5.6

Some command differences between versions: show i...

Uniapp's experience in developing small programs

1. Create a new UI project First of all, our UI i...

Detailed explanation of Vue data proxy

Table of contents 1. What I am going to talk abou...

MySQL Workbench download and use tutorial detailed explanation

1. Download MySQL Workbench Workbench is a graphi...

Explanation of Dockerfile instructions and basic structure

Using Dockerfile allows users to create custom im...

MySQL trigger detailed explanation and simple example

MySQL trigger simple example grammar CREATE TRIGG...