Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of shrinking shared tablespaces by mysql

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the method of mysql shrinking shared table space". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the method of mysql shrinking shared table space".

When using shared tablespaces in mysql, because the tablespaces cannot automatically shrink the space, you need to shrink the data after export, and then import the data.

1. Export database data (multiple databases)

/ usr/local/mysql/bin/mysqldump-uroot-p-- socket=/tmp/mysql_3306.sock-- default-character-set=utf8-- opt-- extended-insert=true-- triggers-R-- hex-blob-- single-transaction-- no-autocommit-- databases hgame openfire powerm > db_name.sql

two。 Stop the database

/ usr/local/mysql/bin/mysqladmin-uroot-p-- socket=/tmp/mysql_3306.sock shutdown

3. Delete related files

Ibdata1

Ib_logfile*

Mysql-bin.index

4. Delete related database directories

5. Start the database

/ usr/local/mysql/bin/mysqld_safe-defaults-file=my.cnf-socket=/tmp/mysql_3306.sock &

6. Import data

/ usr/local/mysql/bin/mysql-uroot-p

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report