Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 985817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:13:19+00:00 2026-05-16T05:13:19+00:00

I am using MySQL in localhost as a query tool for performing statistics in

  • 0

I am using MySQL in localhost as a “query tool” for performing statistics in R, that is, everytime I run a R script, I create a new database (A), create a new table (B), import the data into B, submit a query to get what I need, and then I drop B and drop A.

It’s working fine for me, but I realize that the ibdata file size is increasing rapidly, I stored nothing in MySQL, but the ibdata1 file already exceeded 100 MB.

I am using more or less default MySQL setting for the setup, is there a way for I can automatically shrink/purge the ibdata1 file after a fixed period of time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:13:20+00:00Added an answer on May 16, 2026 at 5:13 am

    That ibdata1 isn’t shrinking is a particularly annoying feature of MySQL. The ibdata1 file can’t actually be shrunk unless you delete all databases, remove the files and reload a dump.

    But you can configure MySQL so that each table, including its indexes, is stored as a separate file. In that way ibdata1 will not grow as large. According to Bill Karwin’s comment this is enabled by default as of version 5.6.6 of MySQL.

    It was a while ago I did this. However, to setup your server to use separate files for each table you need to change my.cnf in order to enable this:

    [mysqld]
    innodb_file_per_table=1
    

    https://dev.mysql.com/doc/refman/5.6/en/innodb-file-per-table-tablespaces.html

    As you want to reclaim the space from ibdata1 you actually have to delete the file:

    1. Do a mysqldump of all databases, procedures, triggers etc except the mysql and performance_schema databases.
    2. Drop all databases except the above 2 databases(mysql and performance_schema)
    3. Stop mysql
    4. Delete ibdata1 and ib_log files
    5. Start mysql
    6. Restore from dump

    When you start MySQL in step 5 the ibdata1 and ib_log files will be recreated.

    Now you’re fit to go. When you create a new database for analysis, the tables will be located in separate ibd* files, not in ibdata1. As you usually drop the database soon after, the ibd* files will be deleted.

    http://dev.mysql.com/doc/refman/5.1/en/drop-database.html

    You have probably seen this:
    http://bugs.mysql.com/bug.php?id=1341

    By using the command ALTER TABLE <tablename> ENGINE=innodb or OPTIMIZE TABLE <tablename> one can extract data and index pages from ibdata1 to separate files. However, ibdata1 will not shrink unless you do the steps above.

    Regarding the information_schema, that is not necessary nor possible to drop. It is in fact just a bunch of read-only views, not tables. And there are no files associated with the them, not even a database directory. The informations_schema is using the memory db-engine and is dropped and regenerated upon stop/restart of mysqld. See https://dev.mysql.com/doc/refman/5.7/en/information-schema.html.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There isn't an equivalent out of the box. You may… May 16, 2026 at 2:10 pm
  • Editorial Team
    Editorial Team added an answer Well there is no clear limit. You can continue doing… May 16, 2026 at 2:10 pm
  • Editorial Team
    Editorial Team added an answer CSS doesn't accept query string parameters. The v=1 usually indicates… May 16, 2026 at 2:10 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am using this code to insert some values in MySql table: <?php mysql_connect(localhost,root,root);
I have code that in the connection setup selects the database using mysql_select_db(). $link
I am working on an Asset Database problem using PHP / MySQL. In this
There is a table employee in the database abc_db at abc@localhost(server) and there is
I'm trying to create a csv export of data from mysql using the following
I'm using MySQL and a web-service connect to the database to read some values.
I am facing some problem with MySQL database. actually It was fast when I
response.setContentType(text/html); PrintWriter out = response.getWriter(); Connection conn = null; String url = jdbc:mysql://localhost:3306/; String
I tried creating a SSH tunnel using ssh -L 3306:localhost:22 <hostip> Then running my
I'm trying to move the data from one table to another based on names

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.