How can I create a database from an sql backup file ?

First, create the database..


/path/to/bin/mysqladmin -u $mysqlusername -p$mysqlpassword create $mysqldatabasename


Then, add user permission to it..

/path/to/bin/mysqladmin -u usernamehere -ppasshere create databasename


Finally, add the tables back....


/path/to/bin/mysql -u $mysqlusername -p$mysqlpassword $mysqldatabasename < backup.sql

OR:

mysql -u user -p -e 'source backup_file' database

 

  • 30 Users Found This Useful
Was this answer helpful?

Related Articles

How can I see all running processes from my server?

Type the following command from shell prompt.It will display the currently running processes. ps...

Connecting to your Windows server

To connect to your Windows VPS or Dedicated server, you use Remote Desktop Connection. Go to:...

Connecting to your Linux server

To connect to your Linux VPS or Dedicated Server, you need a ssh client.  We recommend...

Memory usage seems too high inside a VPS

There are cases when you may notice that the memory usage is too high inside your VPS without a...

How to enable swap inside your VPS

A lot of people are asking about swap in an OpenVZ VPS. Usually swap is not good but in some...