MySQL installation and configuration methods and precautions under Windows platform

MySQL installation and configuration methods and precautions under Windows platform

2.1、msi installation package

2.1.1、Installation

It is particularly important to note that before installation, the original my.ini and the original data directory must be deleted, or the name can be changed. Otherwise, the "apply security settings" will report a 1045 error in the last step. Reason 1: firewall, reason 2: data files have not been cleared.

Next all the way, choose custom installation

You can specify the location of the data, not the system disk

By the way, select "detailed configuration"

Server type and purpose depends on whether it is a development or production environment

"bestsupport for multilingualism" supports most languages, the default character set is UTF-8, use this
It is best to select "addfirewall exception for this port", especially on a development machine.
"enabledstrict mode" is recommended for production machines, but not required for development machines. If selected, the problems that require attention at the beginning may occur easily.
"Includebin directory in windows path" is strongly recommended to be selected, otherwise you need to manually configure the path

"createanonymous account" is not needed

If there are no accidents, it will be done successfully.

Solution to root login failure after installation

mysql -h localhost -u root -p
cmd
net stop mysql
mysqld --skip-grant-tables

#Note, netstart mysql --skip-grant-tables can be started, but it seems to have no effect

The window may be dead, no matter what, open another window

cmd
mysql -u root

Found that I went straight in.

use mysql

update user set password=password("new password") where user='root' and host='localhost';

flush
previliges;

OK, a few points to note:

1. net start mysql --skip-grant-tables, can start, but it seems to have no effect
2. MySQL is a built-in database
3. The user table is a table in the MySQL database that stores usernames, passwords, and permissions
4. The password should be encrypted using the password() function
5. The condition host='localhost' is optional. Then all root passwords will be changed. This is not recommended. I will briefly talk about mysql users later.
6. At this time, the password modification method of set method mysqlamdin -u root -p password "new password" does not work, and the only way is to modify the database directly

2.1.2 Uninstall

1. You can uninstall it in the control panel
2. It is best to uninstall through the original installation package, double-click and select "remove", which is more thorough

2.2. zip file (unverified)
2.2.1、Installation

1. Download MySQL
2. Unzip to c:/mysql
3. Copy my-large.ini to c:/windows/my.ini
4. Modify the my.ini file

basedir="c:/mysql" installation directory datadir="c:/mysql/data" data directory [WindowsMySQLServer]
Server="c:/mysql/bin/mysqld.exe"

5. Installation service

c:/mysql/bin/mysqld.exe --install

6. Start/Stop Service

net start/stop mysql

2.2.2 Uninstall

c:/mysql/bin/mysqld.exe --remove

2.3、Common command parameters and usage; == \g

Adding \G after the command will make the display more beautiful

2.3.1、mysql

-hhost
-uuser
-ppassword (note that the password is usually not entered. If entered, there should be no space between it and -p)
-Pport, usually 3306 is not commonly used

databasename database name, equivalent to executing use database

-e "sql" execute statement

mysql -h localhost -u root -ppassword mysql -e "select user,host from user"

2.3.2、mysqladmin

a) Change password

mysqladmin -u root -p password "new password"

Notice:

1. Password is equivalent to a function and is required
2. The new password should be enclosed in double quotes

<<:  Three.js sample code for implementing dewdrop animation effect

>>:  How to test the maximum number of TCP connections in Linux

Recommend

Seven Principles of a Skilled Designer (2): Color Usage

<br />Previous article: Seven Principles of ...

Detailed explanation of Vue development Sort component code

Table of contents <template> <ul class=&...

How to reasonably use the redundant fields of the database

privot is the intermediate table of many-to-many ...

Detailed explanation of Vue's list rendering

Table of contents 1. v-for: traverse array conten...

Summary of React's way of creating components

Table of contents 1. Create components using func...

Example of how to achieve ceiling effect using WeChat applet

Table of contents 1. Implementation 2. Problems 3...

JS Canvas interface and animation effects

Table of contents Overview Canvas API: Drawing Gr...

Detailed explanation of the solution to the nginx panic problem

Regarding the nginx panic problem, we first need ...

Native JS to implement the aircraft war game

This article example shares the specific code of ...

WEB Chinese Font Application Guide

Using fonts on the Web is both a fundamental skill...