The method of exporting data by mysql
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.