ibdata reduce size

Step 01) MySQLDump all databases into a SQL text file (call it SQLData.sql)
Step 02) Drop all databases (except mysql, performance_schema, and information_schema)
Step 03) Shutdown mysql
Step 04) Add the following lines to /etc/my.cnf
[mysqld]

innodb_file_per_table
innodb_flush_method=O_DIRECT
innodb_log_file_size=1G
innodb_buffer_pool_size=4G

Whatever your set for innodb_buffer_pool_size, make sure innodb_log_file_size is 25% of innodb_buffer_pool_size.

Step 05) Delete ibdata1, ib_logfile0 and ib_logfile1
At this point, there should only be the mysql schema in /var/lib/mysql

Step 06) Restart mysql
This will recreate ibdata1 at 10MB, ib_logfile0 and ib_logfile1 at 1G each

Step 07) Reload SQLData.sql into mysql
ibdata1 will grow but only contain table metadata

Each InnoDB table will exist outside of ibdata1

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

 Client does not support authentication protocol requested by server

If you have a mysql authentication issues related to the error below you can take the following...

 Connect to mysql server under docker

You can use below command to connect to a mysql dockerized version: mysql -u root -h 127.0.0.1...

 Database with latin1 content but over a utf8 connection

It is often the case where you want to migrate to a new server.The new server may be configured...

 Host is not allowed to connect to this MariaDB server

The error "Host is not allowed to connect to this MariaDB server" usually points to a remote...

 Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

If you receive this error below when you try to import an sql into your database: Incorrect...