How to Import MySQL dump file with Red Hat 6
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.
You command is correct. The extension of the filename is not important. It is what's inside that matters.
- A Linux, Apache, MySQL, PHP (LAMP) stack is a combination of open source software that is typically installed together to enable a server to host dynamic […]
- MySQL is an the most popular open-source database management system, in most of hosting company its has been bundle by LAMP(Linux, Apache, MySQL, PHP/Python/Perl) stack. Another alternative […]
- MySQL is the world’s most popular open-source database. Despite its powerful features, MySQL is simple to set up and easy to use. Below are some instructions […]