Linux/Mysql

From Wiki
< Linux
Revision as of 07:13, 13 March 2019 by Marcluer (talk | contribs)

List Databases

mysql -u root -p
show databases;
 
mysql -u root -p -e 'show databases;'
echo "show databases;" | mysql

Dump Database

mysqldump -u root -p databasename > databasename.sql

mysqldump -u root -p --quick --add-drop-table --complete-insert --allow-keywords databasename > databasename.sql

Import Database

mysql -u root -p databasename < databasename.sql

Import Database in Docker

docker exec -i mysql-container mysql -uuser -ppassword name_db < data.sql