MySQL uses batch processing commands to automatically delete and recreate databases to compress ibdata1 file capacity

Source: Internet
Author: User

I. Reminder: The following operations will delete the database. Please back up the database files on your own in advance.

2. Three files are required. The file names and content of the three files are as follows:

File 1: Mysql_Drop_DataBase.txt. The content is as follows:

Drop database yourdatabase;

File 2: Mysql_Create_DataBase.txt. The content is as follows:

Create database yourdatabase;

File 3: automatically compress the ibdata1 file capacity. bat with the following content:

Rem deletes a database
Mysql-u username -- password = password <"Mysql_Drop_DataBase.txt"

Rem stops mysql Service
Net stop mysql

Rem deletes ibdata1, iblogfile0, and ib_logfile1 files. Replace the following file path.
Del "G: \ MySQL Datafiles \ ibdata1"
Del "C: \ ProgramData \ MySQL Server 5.5 \ data \ ib_logfile0"
Del "C: \ ProgramData \ MySQL Server 5.5 \ data \ ib_logfile1"

Rem starts mysql Service
Net start mysql

Rem create database
Mysql-u username -- password = username <"Mysql_Create_DataBase.txt"

3. Click "automatically compress ibdata1 file capacity. bat" to start running.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.