Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ubuntu Command Line Database Import and Export parsing

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following mainly brings you Ubuntu command line database import export parsing, hope that Ubuntu command line database import export parsing can bring you practical use, this is also my main purpose of editing this article. All right, don't talk too much nonsense, let's just read the following.

Mysqldump-h host-u user name-p database name > exported database name. sql

Some of the more commonly used parameters are:

-p or-- the port of the CVM to which port is connected. If the port of MySQL is not 3306, this parameter is required.

-d or-- no-data do not have detailed data, just export the structure of the data

-- when creating a table, add-drop-table first drop the existing table with the same name [usually followed by the-d parameter]

Let's take example's database as an example to do an export example:

1. Export all data (including table structure, including data) from the entire example database

Mysqldump-h 127.0.0.1-u root-p example > example.sql

two。 Just export the structure of the table

Mysqldump-h 127.0.0.1-u root-p-d-- add-drop-table example > example.sql

Import, there are many ways, of which the most simple is the source command, first connect to the database. Then use source to import the file with the specified path.

Connect to MySQL:

Mysql-u root-p

Create the database first, because there is no statement to create the database in the exported file, and if the database has been built, you don't have to create it again.

CREATE DATABASE example; (database name can be different)

Switch the database:

Use example

Import the specified sql file:

Mysql > source / path/example.sql

For the above Ubuntu command line database import export parsing, we do not think it is very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report