• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

Import MySQL database Newbir Question

Good day,

I run a mysql server on Linux.

I have a mysql database dumpfile on a  prodserver . I would like to create a NEW DB on the same server and import this backup into it..  

I have logged in, and created a database like this:

Mysql> create database testmax;
Query OK, 1 row affected (0.06 sec)
mysql> use testmax;
Database changed
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| phpmyadmin         |
| procorp            |
| testmax            |
+--------------------+

(I want to import  procorp's backup in testmax)

Now, I am at the part where i want  to populate this testmax  database with my existing  procorp backup. I also want to make sure i dont overwrite the procorp database (production database)

How do I do that?

I know in Oracle you can set ORACLE_SID but im not familiar with mysql.
0
maxalarie
Asked:
maxalarie
2 Solutions
 
johanntagleCommented:
Export procorp using mysqldump

mysqldump -u user -p procorp > dumpfilename

Import it using mysql

mysql -u user -p testmax < dumpfilename

0
 
manojmalviyaCommented:
You first need to create a dump/backup file of current database

mysqldump --routines -p <username> -p <password> procorp > dump.sql

--routines flag will instruct mysqldump to also dump triggers and functions

then login to mysql commandline tool

mysql -u <username> -p<password>

then type following 2 commands

use testmax;

source <pathtodumpfile>;


0
 
maxalarieAuthor Commented:
Thanks guys,.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now