Import MySQL dumpfile, SQL datafile into my database

source

Q. How can I import a MySQL dumpfile into my database?
My old hosting provider gave me data.sql file. I do have access via ssh to server. I’m using CentOS Linux 5 server.
A. You can easily restore or import MySQL data with mysql command itself. First you need to login to your system using ssh or putty (from Windows based system). For example:
Type the following command at the shell prompt:
$ ssh loginname@server.hosting.com
Now type following command to import sql data file:
$ mysql -u username -p -h localhost data-base-name < data.sql
If you have dedicated database server, replace localhost name with actual server name or IP address:
$ mysql -u username -p -h 202.54.1.10 databasename < data.sqlOR use hostname such as mysql.hosting.com
$ mysql -u username -p -h mysql.hosting.com database-name < data.sql
If you do not know the database name or database name is included in sql dump you can try out something as follows:
$ mysql -u username -p -h 202.54.1.10 < data.sql

How to restore MySQL database from sql dump file?

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *