0

We had some problems with our MySQL server and somehow all I've got is a database.mysql file for the database I want to restore.

I've done a bit of googleing but I didn't find anything about how should I handle this type of file.

It's worth mentioning that the server was running Plesk and the database wasn't using InnoDB.

Edit: I've forgot to mention that I don't know what application created the .mysql file and that it's in binary format.

Thanks,

Brayn
  • 281
  • 2
  • 3
  • 9
  • 1
    what is the output of `file database.mysql`? Perhaps it is just a compressed dump? – Zoredache Jan 04 '11 at 18:03
  • Turns out it was a compressed dump and I was able to decompress it and restore my tables. If you'll update your answer I'll mark this as closed. – Brayn Jan 04 '11 at 22:06

1 Answers1

0

How was the database.mysql created? If it was just a standard mysqldump then all you should have to do is something like cat database.mysql | mysql -h hostname -u username -p [database].

You can tell it is a mysql dump file by looking at the file in a text editor. The first few lines of a mysqldump will look like this.

-- MySQL dump 10.11
--
-- Host: web-06.example.org    Database: mysql
-- ------------------------------------------------------
-- Server version   5.0.51a-24+lenny4

If it is a dump you may need to examine the dump file a bit. It may not perform the required create database statement, and you may need to do that. You will probably also need to recreate any accounts if the dump you have didn't include the database named mysql which includes the accounts and privileges.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • I forgot to mention that it's a binary file. Thanks. – Brayn Jan 04 '11 at 18:00
  • what is `cat`? Would this work on Windows Server? – J86 Jul 28 '16 at 17:49
  • @Ciwan in the above `cat` sends the output of the file into the pipe. In the cmd shell on Windows you would probably use `type`. Also see http://stackoverflow.com/questions/60244/is-there-replacement-for-cat-on-windows – Zoredache Jul 28 '16 at 21:03