Home > Database > Mysql Tutorial > body text

Install mysql-5.7.21 under windows

亚连
Release: 2019-02-27 15:02:01
Original
3886 people have browsed it

This article describes the specific steps to install the mysql service under windows. I hope it will be helpful to everyone.

Preface

This is the first time I installed MySQL on my computer, because MySQL has been disabled since version 5.6. Changes have been made. After decompression in the downloaded installation-free package, there is no data folder and mydefault.ini file. Therefore, some installation methods on the Internet are no longer effective.

Recommended related mysql video tutorials: "mysql tutorial"

Download

Enter the MySQL official website, find the download link, and download as shown in the picture:

Install mysql-5.7.21 under windows

##Installation

Direct Unzip the downloaded installation package to the installation path (I put it under D:\mysql);

In the decompressed D:\mysql\mysql-5.7.21-winx64 directory, create it manually The my.ini file I created using Notepad has the following content:

[mysql]

# 设置mysql客户端默认字符集

default-character-set=utf8

[mysqld]

skip-name-resolve
skip-grant-tables

#设置3306端口

port = 3306

# 设置mysql的安装目录

basedir=D:\mysql\mysql-5.7.21-winx64

# 设置mysql数据库的数据的存放目录

datadir=D:\mysql\mysql-5.7.21-winx64\data

# 允许最大连接数

max_connections=200

# 服务端使用的字符集默认为8比特编码的latin1字符集

character-set-server=utf8

# 创建新表时将使用的默认存储引擎

default-storage-engine=INNODB
Copy after login

Install MySQL service


Run cmd as administrator and enter D:\mysql\mysql-5.7 .21-winx64\bin directory;

Execute the command: mysqld install

The prompt "service successfully installed" appears, which means the installation is successful

Create the data file, please note, Do not create it manually here. Also execute the command in this directory: mysqld–initialize-insecure –user=mysql. At this time, the data folder will appear in the D:\mysql\mysql-5.7.21-winx64 directory, and the default is created. Database, the logged-in user name is root, and the password is empty.

Start the MySQL service. There are many ways to start it:


Find the Windows Task Manager, switch to the service tab, and click the "Service" button in the lower right corner. Needless to say, this goes without saying.

Enter cmd in the D:\mysql\mysql-5.7.21-winx64\bin directory and enter the command: net start mysql.

If you don’t want to switch to the bin directory to execute MySQL statements, you can add the bin directory path to the environment variable. I won’t go into details.

Log in to the database, enter the command: mysql -u root –p, the password is empty.

Show which databases there are, show databases; (note that there is a semicolon after the sql statement, indicating the end of the statement, execute the statement):

Install mysql-5.7.21 under windows

Change password


Enter the mysql database: use mysql;

Change the password: update user set authentication_string="123456";, at this time the password is changed to 123456

At this point, local The database can be used happily. You can use navicat to manage and use the database more conveniently, as shown below:

Install mysql-5.7.21 under windows

The above are the steps I have compiled to install mysql. I hope it can help those who don’t know how to install it yet.

Related articles:

About PHP - Interaction between AJAX and MySQL

Related knowledge about PHP MySQL prepared statements

Solution to PHP MySQL high concurrency locking transaction processing problem

The above is the detailed content of Install mysql-5.7.21 under windows. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template