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

Solution for applying CSS3 transforms to background images

CSS transformations, while cool, have not yet bee...

A brief discussion on ifnull() function similar to nvl() function in MySQL

IFNULL(expr1,expr2) If expr1 is not NULL, IFNULL(...

Vue implements paging function

This article example shares the specific code of ...

Introduction to several ways to introduce CSS in HTML

Table of contents 1. Embed CSS styles directly in...

Example code for CSS pseudo-classes to modify input selection style

Note: This table is quoted from the W3School tuto...

Summary of discussion on nginx cookie validity period

Every visit will generate Cookie in the browser, ...

IDEA configuration process of Docker

IDEA is the most commonly used development tool f...

About 3 common packages of rem adaptation

Preface I wrote an article about rem adaptation b...

HTML+CSS to create heartbeat special effects

Today we are going to create a simple heartbeat e...

How to install and configure GitLab on Ubuntu 20.04

introduce GitLab CE or Community Edition is an op...

Detailed explanation of the principle of creating tomcat in Eclipse

When creating a tomcat server on a local eclipse,...

How to use Linux locate command

01. Command Overview The locate command is actual...

Solution to win10 without Hyper-V

Are you still looking for a way to enable Hyper-v...

MySQL integrity constraints definition and example tutorial

Table of contents Integrity constraints Definitio...

xtrabackup backup and restore MySQL database

Due to some of its own characteristics (locking t...