How to import a mysql database from command line

TLDR

 mysql -u your_mysql_user -p your_mysql_database < your_mysql_script.sql

It’s simply telling mysql:

  • which user is doing the database import using -u
  • to which database it should be imported using -p
  • and finally from which file using <

In depth

Sorry, if you want to go in depth just google it:

https://www.google.com/search?q=import+database+mysql+command+line&oq=import+database

Posted in Code Tricks, Transact SQL, Web Development.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.