Home Database Mysql Tutorial Graphical tutorial on the installation and configuration of mysql5.7.15 in Windows environment

Graphical tutorial on the installation and configuration of mysql5.7.15 in Windows environment

Jul 24, 2017 pm 03:46 PM
windows Configuration

这篇文章主要为大家详细介绍了mysql 5.7.15 安装配置方法图文教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

因本人需要需要安装MySQL,现将安装过程记录如下,在自己记录的同时,希望对有疑问的人有所帮助。

一、下载软件

1. 进入mysql官网,登陆自己的oracle账号(没有账号的自己注册一个),下载Mysql-5.7.15,下载地址:http://dev.mysql.com/downloads/mysql/

2.将下载好的文件解压到指定目录,笔者解压在D:\mysql-5.7.15-winx64

二、 安装过程

1.首先配置环境变量path,将D:\mysql-5.7.15-winx64\bin配置到自己的path中,具体再次不详述

2.在解压路径下复制my-default.ini,修改名称为my.ini如下图所示

3.打开文件my.ini,添加内容如下:


[mysqld] 
basedir=D:\\mysql-5.7.15-winx64 
datadir=D:\\mysql-5.7.15-winx64\\data 
port=3306
Copy after login

sql_mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"  

其中basedir:是上述mysql的解压路径

datadir:后续初始化等数据都会保存在该目录下(注意:不要在该文件目录下新建data文件夹,我的新建data文件夹就会出错,按我的操作步骤,后续操作会自动创建的。)
port:表示连接数据库的端口
sql_mode:表示sql的模式

三、 初始化数据库   配置相关信息

1.以管理员身份运行windows 命令行(特别提醒:WIN7及WIN7以上版本系统这里一定要用管理员身份,不然后续操作会出错)

2. 进入mysql的解压缩目录 D:\mysql-5.7.15-winx64\bin(提醒:此处需要进入bin目录,否则后续操作会出现错误)

3.输入:mysqld --initialize --user=mysql --console,执行后进行初始化,此时会生成root的初始密码

记下此时生成的初始化密码。

4.注册Mysql服务。运行命令:mysqld --install MySQL

如果出现:"Service successfully installed.“ 提示,证明成功安装mysql服务.

5.此时,可以起动mysql服务,net start mysql

用户可能会出现如下错误:
发生系统错误 2. 系统找不到指定文件。

错误原因:如上所述,在运行安装service命令:mysqld --install MySQL时,我们没有进入bin目录,进行安装。                      
解决方案:进入bin目录,首先移除service,运行命令 mysqld --remove
Service successfully removed。
重新安装mysql服务,运行命令mysqld --install ,再启动mysql服务
D:\mysql-5.7.15-winx64>net start mysql
MySQL 服务正在启动
MySQL 服务已启动成功
此时mysql服务已成功起动。

四、登陆数据库,修改密码

在my.ini文件中在[mysqld]后一行加入skip-grant-tables
此时,关闭mysql服务,再重新启动。
(命令行中输入net stop mysql关闭MySQL服务,输入net start mysql 开启MySQL服务)
登陆:输入 mysql -u root -p 后回车键,密码为空,不输入,直接回车,即可登录MySQL

选择mysql数据库:

查询mysql数据库的user表,select * from user

此时,我们发现密码字段的名称为authentication_string。有的可能会是password,根据你查询出来的结果为准。
对表user执行update操作:update user set authentication_string = password("123456") where user="root" 

操作成功。退出mysql
删除my.ini 文件中的skip-grant-tables ,重新启动mysql服务。登录MySQL

Possible problems in the future:
After installing mysql, after logging in, no matter what command is run, this is always prompted: You must reset your password using ALTER USER statement before executing this statement.

When this problem occurs, you only need to continue running the following two commands under the command line mysql:

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

flush privileges;


Note: The above are 2 commands and need to be executed separately.

After completing the above two commands, MySQL will be installed completely.

The above is the detailed content of Graphical tutorial on the installation and configuration of mysql5.7.15 in Windows environment. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? Feb 21, 2025 pm 10:54 PM

The way to update ByBit exchanges varies by platform and device: Mobile: Check for updates and install in the app store. Desktop Client: Check for updates in the Help menu and install automatically. Web page: You need to manually access the official website for updates. Failure to update the exchange can lead to security vulnerabilities, functional limitations, compatibility issues and reduced transaction execution efficiency.

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Coinsuper exchange software channel official website entrance Coinsuper exchange software channel official website entrance Feb 21, 2025 pm 10:39 PM

The official website entrance of the Coinsuper Exchange: https://www.coinsuper.com. The client download channels are: Windows client, macOS client, and mobile (iOS/Android). Registration requires an email, mobile phone number and password, and you need to complete real-name authentication before you can trade. The platform provides a variety of digital asset transactions, including Bitcoin, Ethereum, etc., with the transaction fee rate of 0.1% for both orders and acceptors. Security safeguards include cold wallet storage, dual-factor verification, anti-money laundering and anti-terrorism financing measures, and with security public

Ouyi okx installation package is directly included Ouyi okx installation package is directly included Feb 21, 2025 pm 08:00 PM

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

BITGet official website installation (2025 beginner's guide) BITGet official website installation (2025 beginner's guide) Feb 21, 2025 pm 08:42 PM

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Get the gate.io installation package for free Get the gate.io installation package for free Feb 21, 2025 pm 08:21 PM

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

See all articles