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

WeChat applet implements a simple handwritten signature component

Table of contents background: need: Effect 1. Ide...

Vue imports Echarts to realize line scatter chart

This article shares the specific code of Vue impo...

Vue Element-ui form validation rule implementation

Table of contents 1. Introduction 2. Entry mode o...

JavaScript to display hidden form text

This article shares the specific code of JavaScri...

Analysis of the use and principle of Docker Swarm cluster management

Swarm Cluster Management Introduction Docker Swar...

An enhanced screenshot and sharing tool for Linux: ScreenCloud

ScreenCloud is a great little app you didn’t even...

Disabled values ​​that cannot be entered cannot be passed to the action layer

If I want to make the form non-input-capable, I se...

Pure CSS header fixed implementation code

There are two main reasons why it is difficult to...

Details of the underlying data structure of MySQL indexes

Table of contents 1. Index Type 1. B+ Tree 2. Wha...

Detailed explanation of keywords and reserved words in MySQL 5.7

Preface The keywords of MySQL and Oracle are not ...

How to implement variable expression selector in Vue

Table of contents Defining the HTML structure Inp...

Example of using javascript to drag and swap div positions

1 Implementation Principle This is done using the...