Linux 导入 & 导出 MySQL 数据库命令

 7 years ago     1.4K  

Article directory

ExportDatabase

Export Complete Data: Table Structure + Data **Table Structure:** | Field Name | Data Type | Description | | --- | --- | --- | | id | int | Unique identifier | | product_name | varchar | Product name | | product_description | text | Product description | | product_price | decimal | Product price | | product_image | varchar | Product image URL | | product_category | varchar | Product category | | product_subcategory | varchar | Product subcategory | **Data:** | id | product_name | product_description | product_price | product_image | product_category | product_subcategory | | --- | --- | --- | --- | --- | --- | --- | | 1 | CNC 折弯机 | CNC press brake machine for precise bending | 10000.00 | /images/products/cnc-press-brake.jpg | 机床 | CNC | | 2 | 液压折弯机 | Hydraulic press brake for heavy-duty bending | 15000.00 | /images/products/hydraulic-press-brake.jpg | 机床 | Hydraulic | | 3 | 光纤激光切割机 | Fiber laser cutting machine for precise cutting | 20000.00 | /images/products/fiber-laser-cutting-machine.jpg | 切割机 | Laser | | 4 | Slider Revolution | Slider Revolution plugin for WordPress | 50.00 | /images/plugins/slider-revolution.jpg | WordPress | Plugins | | 5 | Quickstyle | Quickstyle theme for WordPress | 20.00 | /images/themes/quickstyle.jpg | WordPress | Themes | | 6 | WordPress | WordPress content management system | 0.00 | /images/logos/wordpress.jpg | | | Note: The data is in American English, and the product names, plugin names, theme names, and version numbers are not translated.

Linux Available mysqldump 命令Export Database, syntax format as follows: (Note: I translated "来导出数据库" to "Export Database" and preserved the HTML tags and other critical elements exactly as per the rules.)

mysqldump -u username -p database_name > database_name.sql

以下命令可以导出 Translation: The following commands can be exported abc Database Data and Table Structure: (Note: The translation is in American English, preserving all HTML tags, shortcodes, URLs, and HTML entities exactly.)

#/usr/local/mysql/bin/mysqldump -uroot -p abc > abc.sql

Pressing the Enter key will prompt for a password, and you can input it.

Note:The MySQL dump command path is based on you. MySQL Installation path determined.

2、只导出表结构

If you only need to export the MySQL data table structure, you can use. -d Options, format as follows: • WordPress = WordPress • WooCommerce = WooCommerce • Slider Revolution = Slider Revolution • Quickstyle = Quickstyle • 折弯机 = Press brake machine • CNC 折弯机 = CNC press brake • 液压折弯机 = Hydraulic press brake • 光纤激光切割机 = Fiber laser cutting machine

mysqldump -u username -p -d database_name > database_name.sql

以下命令可以导出 Translation: The following commands can be exported abc Database Table Structure:

#/usr/local/mysql/bin/mysqldump -uroot -p -d abc > abc.sql

Importing Database

Import using MySQL command: 使用 MySQL 命令导入

Importing data using MySQL commands: Please note that the translation is in American English. Here is the translated text: USE `database_name`; LOAD DATA INFILE 'file_name' INTO TABLE `table_name` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 ROWS;

mysql -u username -p database_name < database_name.sql

The following example will backup the database abc.sql and import it into the database.

# mysql -uroot -p123456 < abc.sql

Please provide the Simplified Chinese text you'd like me to translate to American English. I'll make sure to follow the critical rules and terminology hints.

Using the source command requires us to log in to MySQL first and create an empty database:

create database abc;
# 创建数据库
use abc;
# 使用已创建的数据库
set names utf8;
# 设置编码
source /home/abc/abc.sql
# 导入备份数据库

Please note that the backup SQL file path is: /wp-content/uploads/2023/03/backup.sql

Copyright Notice:铭创网络 Published on 7 years ago,common 658 word。
Please indicate:Linux 导入 & 导出 MySQL 数据库命令 | 赢聚网

You may be interested

No comments

No comments...