Skip to main content

Command Palette

Search for a command to run...

How can I create and import a database using command line ?

Updated
1 min read
M

I am Mandeep Singh, a full-stack developer. I created this Blog to bestow my coding experience and love to write on JavaScript, Next.js, Laravel and little bit Unity Game development.

create backup

sudo mysqldump -u root -p dbname > backup.sql

I believe the format is:

mysql -u username -p database_name < /path/to/file.sql

From within mysql:

mysql> use db_name;
mysql> source backup-file.sql;

More from this blog

Mandeep Singh Blog

117 posts