2

I backed up my old database on Ubuntu 10.10 server using MySQL 5.1.49 using mysqldump

Now I want to restore the file on my other machine, using Ubuntu 12.04 server with MySQL version 5.5.32 on it.

I managed to copy the files via rsync but I can't load the DB.

I tried it with:

sudo mysql -u root -p fulldump.sql < fulldump.sql

I get this error:

ERROR 1049 (42000): Unknown database 'fulldump.sql'

BUT the name of the file is fulldump.sql and it's the folder I am currently in of course.

Any ideas?

1 Answer 1

3

To back up MySQL DB on one server and restore on another, do I need the same version of MySQL?

It is preferred but not required. If there is an issue between releases you will be notified though (and with a message that states there is a problem with a specific command or table).


The dump contains all the files for exported database but does not create the database itself. So on the server where you restore the database needs to be created if it does not exist.

Example export:

-- MySQL dump 10.11
--
-- Host: localhost    Database: xxxx
-- ------------------------------------------------------
-- Server version       5.0.96-0ubuntu3

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `xxxx`
--

DROP TABLE IF EXISTS `xxxx`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `xxxx` (

There is no creation of the database in the export.

2
  • ok. when I simply do : mysql> create database dbname; is that enough ? or do i have to really create the db in the same structure. because i am still new to mysql stuff, I try to avoi d that. thanks
    – Private
    Aug 15, 2013 at 11:37
  • no you just need to open mysql and do a "create database {databasename}". 1 thing: you also need to have privileges for that database ;)
    – Rinzwind
    Aug 15, 2013 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .