How to import mysql database from terminal?
I can't find the exact syntax.
P粉6330757252023-10-11 10:06:07
Preferred method for Windows:
Open the console and start interactive MySQL mode
use
source
P粉9365685332023-10-11 00:30:32
Assuming you are using a Linux or Windows console:
Prompt for password:
mysql -u <username> -p <databasename> < <filename.sql>
Enter password directly (unsafe):
mysql -u <username> -p<PlainPassword> <databasename> < <filename.sql>
Example:
mysql -u root -p wp_users < wp_users.sql mysql -u root -pPassword123 wp_users < wp_users.sql
See also:
4.5.1.5. Execute SQL statements from text files
Note: If you are using Windows, you must cd
(change directory) to the MySQL/bin directory within CMD before executing the command. p>