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

The method of exporting data by mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

How does mysql export data? This problem may be our daily study or work often see. I hope you learned something from this question. The following is the reference content brought to you by Xiaobian. Let's take a look together!

A brief introduction to the command line to enter MySQL:

C:\>mysql -h hostname -u username -p

Press ENTER key, wait and input password. Password input is implicit input. Press keyboard directly to input password. It will not be fed back to interface. Here hostname is the name of the server, such as localhost, and username is the MySQL username, such as root.

After entering the command line, you can directly operate MySQL.

2. A brief introduction to MySQL commands: (Recommended lesson learning: MySQL video tutorial.)

MySQL->CREATE DATABASE dbname;

create a database

MySQL->USE dbname;

select database

MySQL->CREATE TABLE tablename;

create tables

MySQL->SHOW DATABASES;

Displays database information, which databases are available.

MySQL->SHOW TABLES;

Display table information, which tables are available

MySQL->DESCRIBE tablename;

Export database files from database:

1. Export database mydb to e:\MySQL\mydb.sql file:

Open Start-> Run-> Enter cmd to enter command line mode

Note: This is under command line, not database command.

c:\>MySQLdump -h localhost -u root -p mydb >e:\MySQL\mydb.sql

Note: If access is denied, most cmd needs to run as administrator

Then enter the password, wait for a while to export successfully, you can check whether the success of the target file.

2. Export mytable from database mydb to e:\MySQL\mytable.sql file:

c:\>MySQLdump -h localhost -u root -p mydb mytable>e:\MySQL\mytable.sql

3. Export the structure of database mydb to e:\MySQL\mydb_stru.sql file:

c:\>MySQLdump -h localhost -u root -p mydb --add-drop-table >e:\MySQL\mydb_stru.sql

-h localhost can be omitted, it is generally used on virtual hosts

Thank you for reading! After reading the above content, do you have a general understanding of mysql's method of exporting data? I hope the content of this article is helpful to everyone. If you want to know more about related articles, please pay attention to the industry information channel.

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

Database

Wechat

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

12
Report