Skip to content

Latest commit

 

History

History
27 lines (27 loc) · 650 Bytes

Import_Export_SQLFile.md

File metadata and controls

27 lines (27 loc) · 650 Bytes

How to Import MySQL Database or SQL File

  • Access MySQL with Root User
mysql -u root -p
  • Create New Database
Syntax:- CREATE DATABASE Database_name;
Example:- CREATE DATABASE osmsdb;
  • Access Newly Created Database
Syntax:- USE Database_name;
Example:- USE osmsdb;
  • Import Database or SQL File
Syntax:- source sql_file_path
Example:- source /var/myimporteddb/osmsdb.sql

How to Export MySQL Database as SQL File

  • Export MySQL Database as SQL File
Syntax:- mysqldump -u db_user_name -p Database_Name > File_Path/File_Name.sql
Example:- mysqldump -u root -p dps > /var/myexporteddb/dps.sql