|
|
(6 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| == List Databases ==
| | #REDIRECT [[Mysql]] |
| <pre>
| |
| mysql -u root -p
| |
| show databases;
| |
|
| |
| mysql -u root -p -e 'show databases;'
| |
| </pre>
| |
| | |
| <pre>
| |
| echo "show databases;" | mysql
| |
| </pre>
| |
| | |
| == Dump Database ==
| |
| <pre>
| |
| mysqldump -u root -p databasename > databasename.sql
| |
| | |
| mysqldump -u root -p --quick --add-drop-table --complete-insert --allow-keywords databasename > databasename.sql
| |
| </pre>
| |
| | |
| == Dump Database from Docker ==
| |
| <pre>
| |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
| |
| </pre>
| |
| | |
| == Import Database ==
| |
| <pre>
| |
| mysql -u root -p databasename < databasename.sql
| |
| </pre>
| |
| | |
| == Import Database in Docker ==
| |
| <pre>
| |
| docker exec -i mysql-container mysql -uuser -ppassword name_db < data.sql
| |
| </pre>
| |
| | |
| [[Category:Linux]] | |
| [[Category:Linux/Services]]
| |