Home >Database >Mysql Tutorial >How to import a database into MySQL from the terminal?
Importing a Database into MySQL from the Terminal
Importing a database into MySQL from the command line can be a useful and straightforward task. Here's how you can do it:
Syntax:
mysql -u <username> [-p] <databasename> < <filename.sql>
Parameters:
Examples:
Prompt for password:
mysql -u root -p wp_users < wp_users.sql
Enter password directly (not secure):
mysql -u root -pPassword123 wp_users < wp_users.sql
Note: For Windows users, remember to navigate to the MySQL/bin directory in the CMD before executing the command.
Additional Resources:
The above is the detailed content of How to import a database into MySQL from the terminal?. For more information, please follow other related articles on the PHP Chinese website!