open windows command prompt
Window + R
then type cmd
Now Open C:\Xampp\mysql\bin
in cmd
type "mysql" and hit enter
For importing a database
mysql -u username -p database_name < database_sql_file.sql
Example- mysql -u root -p test_database < test_database.sql
For Exporting
mysql -u username -p database_name > database_sql_file.sql
Example- mysql -u root -p test_database > test_database.sql
export stored procedure and routines along with tables
Use option --routines
mysql --routines -u username -p database_name > database_sql_file.sql
Example- mysql --routines -u root -p test_database > test_database.sql
NOTE:
Here you need test_database.sql file ie. a backup of a databse
This file should be placed in C:\Xampp\mysql\bin
You also need to create a database with any name, here it should be test_database for above example.
You can also use mysqldump instead of mysql
Comments
Post a Comment