Home >Database >Mysql Tutorial >MySQL用批处理命令自动删除重建数据库实现压缩ibdata1文件容量

MySQL用批处理命令自动删除重建数据库实现压缩ibdata1文件容量

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:35:30989browse

MySQL用批处理命令自动删除重建数据库实现压缩ibdata1文件容量

一、友情提醒,,以下操作会删除数据库,请事先自行备份数据库文件

二、需要3个文件,以下为3个文件的文件名及内容:

文件1:Mysql_Drop_DataBase.txt,内容如下:

drop database yourdatabase;

文件2:Mysql_Create_DataBase.txt,内容如下:

create database yourdatabase;

文件3:自动压缩ibdata1文件容量.bat,内容如下:

rem 删除数据库
mysql -u 用户名 --password=密码

rem 停止mysql服务
net stop mysql

rem 删除ibdata1、iblogfile0、ib_logfile1文件,请自行替换以下文件路径
Del "G:\MySQL Datafiles\ibdata1"
Del "C:\ProgramData\MySQL\MySQL Server 5.5\data\ib_logfile0"
Del "C:\ProgramData\MySQL\MySQL Server 5.5\data\ib_logfile1"

rem 启动mysql服务
net start mysql

rem 创建数据库
mysql -u 用户名 --password=用户名

三、点击“自动压缩ibdata1文件容量.bat”开始运行

linux

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