search
HomeDatabaseMysql TutorialHow to install mysql in bat

How to install mysql in bat

Feb 16, 2023 am 09:29 AM
mysqlbat

bat method to install mysql: 1. Download the compressed package version of mysql; 2. Right-click the "MySQL installation.bat" file and run it as administrator; 3. Initialize the database; 4. Through "net start MySQL" to start the MYSQL service.

How to install mysql in bat

The operating environment of this tutorial: Windows 10 system, MySQL version 5.7, Dell G3 computer.

How to install mysql in bat?

Use bat to install mysql with one click

1. Download the compressed package version of mysql. The download address is as follows:

 https:// cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.22-winx64.zip

2. The directory after decompression is as follows:

 

3. Save the following content as a bat file, put the bat file in the directory just now, and then right-click and run as administrator

@setlocal enabledelayedexpansion
@echo off
color f0
rem 编程技术 www.vcvb.cn 出品,转载请保留此信息。
title MYSQL一键安装set basedir=%~dp0set bin=%~dp0\bin
cd /d %~dp0if exist !bin!\mysqld.exe (
rem 写入配置>my.ini echo [mysqld]>>my.ini echo port=3306>>my.ini echo basedir=!basedir!
>>my.ini echo datadir=!basedir!\Data>>my.ini echo log-error=!basedir!\Logs.log>>my.ini echo max_connections=200>>my.ini echo max_connect_errors=10>>my.ini echo character-set-server=utf8mb4>>my.ini echo default-storage-engine=INNODB>>my.ini echo default_authentication_plugin=mysql_native_password>>my.ini echo local_infile=ON>>my.ini echo.>>my.ini echo [mysql]>>my.ini echo default-character-set=utf8mb4>>my.ini echo local_infile=ON>>my.ini echo.>>my.ini echo [client]>>my.ini echo port=3306>>my.ini echo default-character-set=utf8mb4

rem 添加环境变量
echo 开始检查环境变量...
echo.for /f "tokens=2*" %%i ^in ('reg query "HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment" /v Path^|findstr /i "path"') ^do (set "p=%%j")for /f "tokens=*" %%a in ('echo !p! ^| find /i "!bin!"') do (set flag=1)if not defined flag (
echo 开始添加环境变量
setx Path "!p!;!bin!" /M | find "成功" && echo 环境变量添加成功set p=!Path!) else (echo 环境变量已存在,无需设置。)
echo.

rem 初始化 --console
cd !bin!

>!basedir!\Logs.log echo --------初始化数据库开始--------echo 开始初始化数据库

mysqld --initialize-insecure>>!basedir!\Logs.log echo --------初始化数据库结束--------rem 安装服务
echo 开始安装服务
mysqld --install MySQL | find "successfully" && echo 服务安装成功
echo.
rem 启动服务
echo 开始启动MYSQL服务
net start MySQL
echo. 

mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1qaz'";

echo 安装完成
) else (
echo 请将本工具放在解压后的MYSQL根目录下再打开
)
pause >nul

3. The installation is completed and the password has been set to: 1qaz

Note: If the dll is missing during the installation, please install vc runtime and try again

Note: If you want to reinstall, remember to delete the data in the data directory first.

Recommended study: "MySQL Video Tutorial"

The above is the detailed content of How to install mysql in bat. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
What are some tools you can use to monitor MySQL performance?What are some tools you can use to monitor MySQL performance?Apr 23, 2025 am 12:21 AM

How to effectively monitor MySQL performance? Use tools such as mysqladmin, SHOWGLOBALSTATUS, PerconaMonitoring and Management (PMM), and MySQL EnterpriseMonitor. 1. Use mysqladmin to view the number of connections. 2. Use SHOWGLOBALSTATUS to view the query number. 3.PMM provides detailed performance data and graphical interface. 4.MySQLEnterpriseMonitor provides rich monitoring functions and alarm mechanisms.

How does MySQL differ from SQL Server?How does MySQL differ from SQL Server?Apr 23, 2025 am 12:20 AM

The difference between MySQL and SQLServer is: 1) MySQL is open source and suitable for web and embedded systems, 2) SQLServer is a commercial product of Microsoft and is suitable for enterprise-level applications. There are significant differences between the two in storage engine, performance optimization and application scenarios. When choosing, you need to consider project size and future scalability.

In what scenarios might you choose SQL Server over MySQL?In what scenarios might you choose SQL Server over MySQL?Apr 23, 2025 am 12:20 AM

In enterprise-level application scenarios that require high availability, advanced security and good integration, SQLServer should be chosen instead of MySQL. 1) SQLServer provides enterprise-level features such as high availability and advanced security. 2) It is closely integrated with Microsoft ecosystems such as VisualStudio and PowerBI. 3) SQLServer performs excellent in performance optimization and supports memory-optimized tables and column storage indexes.

How does MySQL handle character sets and collations?How does MySQL handle character sets and collations?Apr 23, 2025 am 12:19 AM

MySQLmanagescharactersetsandcollationsbyusingUTF-8asthedefault,allowingconfigurationatdatabase,table,andcolumnlevels,andrequiringcarefulalignmenttoavoidmismatches.1)Setdefaultcharactersetandcollationforadatabase.2)Configurecharactersetandcollationfor

What are triggers in MySQL?What are triggers in MySQL?Apr 23, 2025 am 12:11 AM

A MySQL trigger is an automatically executed stored procedure associated with a table that is used to perform a series of operations when a specific data operation is performed. 1) Trigger definition and function: used for data verification, logging, etc. 2) Working principle: It is divided into BEFORE and AFTER, and supports row-level triggering. 3) Example of use: Can be used to record salary changes or update inventory. 4) Debugging skills: Use SHOWTRIGGERS and SHOWCREATETRIGGER commands. 5) Performance optimization: Avoid complex operations, use indexes, and manage transactions.

How do you create and manage user accounts in MySQL?How do you create and manage user accounts in MySQL?Apr 22, 2025 pm 06:05 PM

The steps to create and manage user accounts in MySQL are as follows: 1. Create a user: Use CREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password'; 2. Assign permissions: Use GRANTSELECT, INSERT, UPDATEONmydatabase.TO'newuser'@'localhost'; 3. Fix permission error: Use REVOKEALLPRIVILEGESONmydatabase.FROM'newuser'@'localhost'; then reassign permissions; 4. Optimization permissions: Use SHOWGRA

How does MySQL differ from Oracle?How does MySQL differ from Oracle?Apr 22, 2025 pm 05:57 PM

MySQL is suitable for rapid development and small and medium-sized applications, while Oracle is suitable for large enterprises and high availability needs. 1) MySQL is open source and easy to use, suitable for web applications and small and medium-sized enterprises. 2) Oracle is powerful and suitable for large enterprises and government agencies. 3) MySQL supports a variety of storage engines, and Oracle provides rich enterprise-level functions.

What are the disadvantages of using MySQL compared to other relational databases?What are the disadvantages of using MySQL compared to other relational databases?Apr 22, 2025 pm 05:49 PM

The disadvantages of MySQL compared to other relational databases include: 1. Performance issues: You may encounter bottlenecks when processing large-scale data, and PostgreSQL performs better in complex queries and big data processing. 2. Scalability: The horizontal scaling ability is not as good as Google Spanner and Amazon Aurora. 3. Functional limitations: Not as good as PostgreSQL and Oracle in advanced functions, some functions require more custom code and maintenance.

See all articles

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

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software