Table of Contents
一、下载
二、安装
1 解压
2 配置环境变量
右击此电脑选择属性
双击系统环境变量的Path
3 配置my.ini
4 命令行启动mysql
WIN+R 输入cmd 进入window命令行
cd 进入安装mysql的bin目录下
5 修改登录密码
Home Database Mysql Tutorial How to install MySQL8.0.x version on Windows

How to install MySQL8.0.x version on Windows

May 27, 2023 pm 07:34 PM
mysql windows

    一、下载

    MySQL官网下载链接:https://downloads.mysql.com/archives/community/

    选择版本后下载zip文件

    How to install MySQL8.0.x version on Windows

    博主选择的是8.0.13

    二、安装

    1 解压

    把下载好的zip包在你想要的路径下直接解压。

    解压完成后得到这个界面:

    How to install MySQL8.0.x version on Windows

    2 配置环境变量

    右击此电脑选择属性

    How to install MySQL8.0.x version on Windows

    How to install MySQL8.0.x version on Windows

    双击系统环境变量的Path

    How to install MySQL8.0.x version on Windows

    新建一个刚刚你解压的路径(注意要到bin路径下)

    3 配置my.ini

    How to install MySQL8.0.x version on Windows

    在D:\Program Files (x86)\mysql-8.0.13-winx64\mysql-8.0.13-winx64路径下新建一个 my.ini 文件。

    这里有一个注意点:如果出现mysql8.0安装报错 error: Found option without preceding group in config file:

    则把ini文件另存为ANSI编码

    文件内容如下:

    [mysqld]
    
    # 设置3306端口
    
    port=3306
    
    # 设置mysql的安装目录
    
    basedir=D:\\Program Files (x86)\\mysql-8.0.13-winx64\\mysql-8.0.13-winx64
    
    # 切记此处一定要用双斜杠\\,单斜杠这里会出错。
    
    # 设置mysql数据库的数据的存放目录
    
    datadir=D:\Program Files (x86)\mysql-8.0.13-winx64\\Data
    # 此处同上
    
    # 允许最大连接数
    
    max_connections=200
    
    # 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
    
    max_connect_errors=10
    
    # 服务端使用的字符集默认为UTF8
    
    character-set-server=utf8
    
    # 创建新表时将使用的默认存储引擎
    
    default-storage-engine=INNODB
    
    # 默认使用“mysql_native_password”插件认证
    
    default_authentication_plugin=mysql_native_password
    
    [mysql]
    
    # 设置mysql客户端默认字符集
    
    default-character-set=utf8
    
    [client]
    
    # 设置mysql客户端连接服务端时默认使用的端口
    
    port=3306
    
    default-character-set=utf8
    Copy after login

    4 命令行启动mysql

    WIN+R 输入cmd 进入window命令行

    How to install MySQL8.0.x version on Windows

    cd 进入安装mysql的bin目录下

    How to install MySQL8.0.x version on Windows

    输入:mysqld --initialize --console

    等待片刻会输出一堆东西,推荐先把这些输出复制一下,放到一个记事本里,因为里面会有你需要的数据库初始密码。

    一般会在root@localhost:之后(是一堆像乱码一样的东西,这是初始的随机密码,后续我们会进行更改!)

    记下密码之后,执行命令:mysqld --install 安装mysql

    正常会输出 successfully

    之后执行命令:net start mysql 启动mysql服务

    5 修改登录密码

    命令:mysql -u root -p 之后复制你刚刚保存在txt文件的初始密码进入mysql

    命令:alter user root@localhost identified by '123456'; 这个 123456是我随便打的 可以自定义修改,如果是mysql8以上,推荐别使用纯数字密码,别问我为什么,都是被坑出来的教训!

    注:如果出现忘记初始随机密码的情况,可以重新执行mysqld --initialize --console这个命令,但是前提是删除之前生成的Data文件夹

    How to install MySQL8.0.x version on Windows

    The above is the detailed content of How to install MySQL8.0.x version on Windows. 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

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    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)

    Hot Topics

    Java Tutorial
    1659
    14
    PHP Tutorial
    1258
    29
    C# Tutorial
    1232
    24
    Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

    Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

    MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

    MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

    MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

    Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

    Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

    Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

    Solve MySQL mode problem: The experience of using the TheliaMySQLModesChecker module Solve MySQL mode problem: The experience of using the TheliaMySQLModesChecker module Apr 18, 2025 am 08:42 AM

    When developing an e-commerce website using Thelia, I encountered a tricky problem: MySQL mode is not set properly, causing some features to not function properly. After some exploration, I found a module called TheliaMySQLModesChecker, which is able to automatically fix the MySQL pattern required by Thelia, completely solving my troubles.

    laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

    To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

    Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

    In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

    How to safely store JavaScript objects containing functions and regular expressions to a database and restore? How to safely store JavaScript objects containing functions and regular expressions to a database and restore? Apr 19, 2025 pm 11:09 PM

    Safely handle functions and regular expressions in JSON In front-end development, JavaScript is often required...

    See all articles