Linux/Mysql: Difference between revisions

From Wiki
(Weiterleitung nach Mysql erstellt)
Tag: New redirect
 
(5 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>
 
docker-compose:
<pre>
    volumes:
        - ./dump.sql:/docker-entrypoint-initdb.d/dump.sql
</pre>
 
[[Category:Linux]]
[[Category:Linux/Services]]

Latest revision as of 12:48, 10 June 2020

Redirect to: