Use the following code to import a MySQL database
mysql -u <username> -p <databasename> < <filename.sql>
If the code ends up with the following error – ” ‘<‘ operator is reserved PowerShell Error ” in cmd, use the following code..
& cmd.exe /c "mysql -u <username> -p <databasename> < <filename.sql>"
You can also import in the following way..
mysql -u root -p
(give the password)
source filenamewithpath.sql
4 thoughts on “How to import a MySQL database / How can I import a database with MySQL from terminal?”
Comments are closed.