Set MySQL option to restore MySQL server after deleting ibdata1
If you got a mysqldump export (.sql) of your databases, you do not need to have stopped mysql in any special way.


Make sure mysql is down

pgrep mysqld
(no output)

Delete everything on your datadir (by default, /var/lib/mysql)

mkdir /tmp/mysql.bak &amp;&amp; sudo mv /var/lib/mysql/* /tmp/mysql.bak

Run:

sudo mysql_install_db

Change the permissions od your datadir to the user mysql:

sudo chown -R mysql:mysql /var/lib/mysql

Start mysql:

sudo service mysql start

Import your databases back:

mysql -u root &lt; your_dump.sql



You will have your databases back on a fresh installation of mysql, with a just created ibdata1.