How to Import MySQL dump file with Red Hat 6

Problem :

I have a VM that I'll be installing mysql server on. I have a dump file that I need to import into mysql. The first line says this:

-- MySQL dump 10.13  Distrib 5.6.20, for linux-glibc2.5 (x86_64)

The file already has databases and tables, along with the structure and data.

 grep -i 'current database' db_dump.txt 
-- Current Database: `db1`
-- Current Database: `db2`
-- Current Database: `db3`

grep -i 'data for table' db_dump.txt 
-- Dumping data for table `TABLE1`
-- Dumping data for table `TABLE2`
-- Dumping data for table `TABLE3`

As you can see, its a .txt file and this is partly where my confusion is coming in. Much of what I have read is that in order to import a text file you must already have the database's and tables created. However they are already defined in the file. So that lead me to running a command such as this:

mysql -u <user> -p < filename.dump

But some of the documentation says you must have a .sql file in order to do this. So can I just rename my .txt file to .sql or just import as is? What would the command look like? I am really a noob when it comes to MySQL so any guidance is much appreciated.

Solution :

You command is correct. The extension of the filename is not important. It is what's inside that matters.

Mysql Tutorials

Mysql Howto..

How to compare values from the joined table with cross join ? mysql

How to insert json values into mysql database [closed]

How to add data to a specific form element when it sends to mySQL

Symfony : Doctrine data fixture : how to handle large csv file?

How to remove accents in MySQL?

Mysql REGEXP how to do an exact match

How to import a MS SQL server table into mysql?

How to check condition before executing MYSQL query (Laravel 5)

how to generate Data Base DB script in MySQL (MySQL Query Browser / Toad for MySQL)

How to run a trigger mysql after startup database mysql [closed]

How to get RANDOM records from each category in MySQL?

How can I update a table in which I make a SELECT query? (Error #1093)

how to define a stored procedures which accepts 2 parameteres

How can I copy a mysql input to another table?

How to store all rows of a column name returned as a mysql query result in a string array

How do I see which columns throughout my database reference one particular column as a foreign key? Like a “reverse” foreign key?

MySQL: How to keep entire myisam table in memory?

How to delete specific numbers of rows in mySQL

How to create a progress chart (MySQL)

How to connected to existing MySQL database in Laravel 5?

how to appear form element only if there is no “%” sign in php

How to optimize mysql query with an inner query

How to upload photo with text?

How to not likes many items in MySQL?

How to properly create composite primary keys - MYSQL

How to serialize C# data to wp_postmeta (MySQL longtext column)

how does one _model_ data from relational databases in clojure?

How do I handle MySQL to Javascript Date Format?

How to get list of dates between two dates in mysql select query [duplicate]

How to make a dropdownlist using mysql query with foreach?