restore_mysql_database_from_the_command_line
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
restore_mysql_database_from_the_command_line [2016/07/24 17:05] โ created walkeradmin | restore_mysql_database_from_the_command_line [2023/03/09 22:35] (current) โ external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
\\ | \\ | ||
\\ | \\ | ||
- | To backup | + | To restore |
\\ | \\ | ||
\\ | \\ | ||
+ | <color red>Last time I tried this it failed, I had to do this:</ | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | **USE THIS METHOD NOW** | ||
+ | ---- | ||
+ | |||
+ | sudo mysql -u root -p<color red> | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | OLD METHOD | ||
+ | ---- | ||
+ | |||
From the command line: | From the command line: | ||
+ | \\ | ||
+ | First you must login to MySQL | ||
+ | \\ | ||
+ | mysql -u root -p โ (the root part assumes root is your mysql username) | ||
+ | \\ | ||
+ | To restore a database, use the following command: | ||
+ | \\ | ||
+ | mysql database_name < database_name.sql | ||
+ | \\ | ||
+ | In the code above, database_name is the name of the database you want to restore, and database_name.sql is the name of the backup file to be restored. | ||
+ | \\ | ||
+ | \\ | ||
+ | If you are trying to restore a single database from dump of all the databases, you have to let mysql know like this: | ||
+ | \\ | ||
+ | mysql --one-database database_name < all_databases.sql | ||
\\ | \\ |
restore_mysql_database_from_the_command_line.1469376326.txt.gz ยท Last modified: 2023/03/09 22:35 (external edit)