Installing MySQL on Microsoft Windows Using a noinstall ZIP Archive

Important
MySQL Community 5.7 Server requires the Microsoft Visual C++ 2013 Redistributable Package to run on Windows platforms. Users should make sure the package has been installed on the system before installing the server.
https://www.microsoft.com/zh-CN/download/details.aspx?id=40784

Extracting the Install Archive

D:\mysql\mysql-5.7.32-winx64

Creating an Option File

D:\mysql\mysql-5.7.32-winx64\my.ini

[client]
default-character-set=utf8

[mysqld]
# set basedir to your installation path
basedir=D:/mysql/mysql-5.7.32-winx64
# set datadir to the location of your data directory
datadir=D:/mysql/mysql-5.7.32-winx64/data

port=3306

character-set-server=utf8

default-storage-engine=InnoDB

Customizing the PATH for MySQL Tools

MYSQL_HOME
D:\mysql\mysql-5.7.32-winx64

%MYSQL_HOME%\bin;

To make it easier to invoke MySQL programs, you can add the path name of the MySQL bin directory to your Windows system PATH environment variable.

You should not add the MySQL bin directory to your Windows PATH if you are running multiple MySQL servers on the same machine.

Initializing the Data Directory

mysqld --initialize --console

A temporary password is generated for root@localhost: _=da(%D0z?&q

Starting the Server for the First Time

mysqld --console

Post-Initialization root Password Assignment

mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '2020';

Starting MySQL from the Windows Command Line

To start the mysqld server from the command line, you should start a console window (or “DOS window”) and enter this command:

mysqld

You can stop the MySQL server by executing this command:

mysqladmin -u root -p shutdown

Starting MySQL as a Windows Service

Installing the service

Before installing MySQL as a Windows service, you should first stop the current server if it is running by using the following command:

mysqladmin -u root -p shutdown

Install the server as a service using this command:

mysqld --install

Starting the service

NET START mysql

Removing the service

NET STOP mysql
mysqld --remove
posted @ 2021-02-03 18:14  clipboard  阅读(130)  评论(0编辑  收藏  举报