As you mentioned, you want to export and import SQL files from the command line with specific options, such as disabling foreign key checks or exporting only table structure.
To export a SQL file, use the mysqldump command with the appropriate options:
mysqldump -u [username] -p [database] [options] > [filename.sql]
Here's a breakdown of the options you mentioned:
For example, to export the structure and data of the blog database while disabling foreign key checks, you would run:
mysqldump -u vivek -p --disable-keys blog > blog.sql
To import a SQL file, use the mysql command:
mysql -u [username] -p [database] < [filename.sql]
For example, to import the blog.sql file into the blog database using the vivek user:
mysql -u vivek -p blog < blog.sql
Remember that the < and > symbols are important for indicating input and output.
The above is the detailed content of How Can I Efficiently Export and Import SQL Files Using Command-Line Options?. For more information, please follow other related articles on the PHP Chinese website!