Jan Fredriksson
Jan Fredriksson

Reputation: 11

Dropped all MySQL databases, including mysql, how recover?

I was attempting to recover some diskspace as described here:

How to shrink/purge ibdata1 file in MySQL

I did a mysqldump for all databases.

Then I dumped all the databases and unfortunately I was a bit fast and deleted the database named "mysql" too.

Now I can not reconnect to the server, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' "

I suppose I have deleted account info etc?

So what are my options? Re-Install MySQL and import the dump?

The MySQL accounts I had where simple so I can easily re-create them.

Upvotes: 1

Views: 907

Answers (1)

Dan Soap
Dan Soap

Reputation: 10248

If you have a dump of all databases, there's no real problem.

Simply issue

mysql_install_db

on the command line, and a new mysql schema will be created. Re-create your accounts, as you suggested, and afterwards import your dump.

Upvotes: 2

Related Questions