Linux/Mysql: Difference between revisions

From Wiki
No edit summary
No edit summary
Line 16: Line 16:


mysqldump -u root -p --quick --add-drop-table --complete-insert --allow-keywords databasename > databasename.sql
mysqldump -u root -p --quick --add-drop-table --complete-insert --allow-keywords databasename > databasename.sql
</pre>
== Import Database ==
<pre>
mysql -u root -p databasename < databasename.sql
</pre>
</pre>


[[Category:Linux]]
[[Category:Linux]]
[[Category:Linux/Services]]
[[Category:Linux/Services]]

Revision as of 07:07, 13 March 2019

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