How to install MySQL using ZIP method: a simple, fast and efficient installation method

  1. Download the MySQL zip file: Download the MySQL zip file for your operating system from the official website https://dev.mysql.com/downloads/mysql/.

    Version introduction (generally choose ZIP Archive version for zip)

    "Windows (x86, 64-bit), ZIP Archive" is a released version of MySQL, which provides MySQL server and related tools for users to use on Windows operating systems. This version contains the official release version of MySQL and is widely used in production and development environments.

    "Windows (x86, 64-bit), ZIP Archive Debug Binaries & Test Suite" is the version for developers and testers. In addition to containing the MySQL server and related tools, it also contains debug versions of the binaries and a complete test suite. This version is primarily used for developing, debugging, and testing MySQL, and it provides more tools and options to help developers diagnose and solve problems.

    The difference mainly lies in the following aspects:

    1. Debug binaries: The "Debug Binaries & Test Suite" version contains debug versions of binaries. These binaries contain additional debugging information that can be used to locate and fix software problems.
    2. Test Suite: The "Debug Binaries & Test Suite" version contains a complete test suite for functional testing and performance testing of MySQL. These tests can help developers verify the correctness and stability of MySQL.
    3. Additional Tools: "Debug Binaries & Test Suite" editions may include additional tools and options for debugging and analyzing MySQL's runtime behavior.

    Generally speaking, for ordinary users and production environments, it is recommended to use the officially released version of "Windows (x86, 64-bit), ZIP Archive". For developers and testers, you can choose the "Debug Binaries & Test Suite" version to get more debugging and testing capabilities.

  2. Unzip the MySQL zip file: Extract the downloaded zip file into a directory of your choice.

  3. Configure MySQL: In the MySQL unzipped directory, create a new my.ini file (if it does not exist). Add the following content to the my.ini file:

    [mysqld]
    # 设置MySQL安装目录的绝对路径(注意要写你自己的)
    basedir=C:/MySQL
    
    # 设置MySQL数据目录的绝对路径(注意要写你自己的)
    datadir=C:/MySQL/Data
    
    # 允许的最大连接数
    max_connections=100
    
    # MySQL服务器的端口号
    port=3306
    
    # 设置字符集为utf8mb4
    character-set-server=utf8mb4
    
    
    # 设置使用的存储引擎
    default-storage-engine=InnoDB
    
    

    Replace <MySQL解压缩目录的绝对路径>and <MySQL数据目录的绝对路径>with your actual directory path.

  4. Initialize the MySQL data directory: Open a command prompt (or terminal), navigate to the MySQL decompression directory, and execute the following command to initialize the MySQL data directory:

    mysqld --initialize-insecure --user=mysql --console
    
  5. Install MYSQL service

    mysqld --install
    
  6. start mysql

    net start mysql
    
  7. Connect to the MySQL server: Open another command prompt (or terminal) window, navigate to the MySQL unzipped directory, and execute the following command to connect to the MySQL server:

    mysql -u root -p
    
  8. Change the root user password: Once you are connected to the MySQL server, use the following command to change the root user password:

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'z123456';
    

    Replace 新密码with the new password you want to set.

  9. Log in to mysql (note: do not add spaces after -u and -p)

    mysql -u账号 -p密码
    

Guess you like

Origin blog.csdn.net/godnightshao/article/details/132610597