MySql: Rebuild (and Shrink) IBDATA1

References: https://dev.mysql.com/doc/refman/5.5/en/innodb-multiple-tablespaces.html https://dev.mysql.com/doc/refman/5.5/en/innodb-resize-system-tablespace.html https://dev.mysql.com/doc/refman/5.5/en/mysqldump.html https://dev.mysql.com/doc/refman/5.5/en/mysqldump-sql-format.html PROCEDURE: ----------------- 1. da shell - For ALL DBs: mysqldump -u [root_username] -p[root_password] [database_name] > database_name.dump.sql 2. da phpMyAdmin o da mysql - For ALL DBs (except mysql, information_schema and performance_schema): DROP DATABASE database_name 3. da shell: sudo /etc/init.d/mysqld stop sudo rm /var/lib/mysql/ibdata1 sudo rm /var/lib/mysql/ib_logfile (and delete any other ib_logfile's that may be named ib_logfile0, ib_logfile1 etc...) (if required, modify my.conf to start innodb-multiple-tablespaces mode) sudo /etc/init.d/mysqld start 4. da phpMyAdmin o da mysql - For ALL DBs: create database [database_name] grant all privileges on [database_name].* to 'username'@'localhost' identified by 'password' (this only if users were deleted with DBs - but should not happen... verify on Table USERS of MYSQL DB ) 5. da shell - For ALL DBs: mysql -u [root_username]-p[root_password] [database_name] < database_name.dump.sql Warning: these instructions will cause you to lose other databases if you have other databases on this mysql instance. Make sure that steps 1,2 and 4,5 are modified to cover all databases you wish to keep.