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

Import and export of mysql

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

Share

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

MySQL command line export database

1. Go to the bin folder under the MySQL directory: the directory to the bin folder in cd MySQL is like the command line I entered: cd C:\ Program Files\ MySQL\ MySQL Server 4.1\ bin

2. Export the database: mysqldump-u user name-p database name > exported file name such as the command line I entered: mysqldump-u root-p news > news.sql (after entering, you will be asked to enter the password for entering MySQL) (if you export a single table, enter the table name after the database name)

3. You will see that the file news.sql is automatically generated to the bin file under the command line to import the database.

1. Move the imported .sql file to the bin file, which is more convenient.

2, same as step 1 derived above

3. Enter MySQL:mysql-u user name-p as I typed the command line: mysql-u root-p (the same will let you enter the password of MySQL)

4. Create the database you want to build in MySQL-Front, which is empty. For example, create a new target database named news.

5, enter: mysql > use target database name such as the command line I entered: mysql > use news

6, import file: mysql > source imported file name; such as the command line I entered: mysql > source news.sql; MySQL backup and restore, are completed by using mysqldump, mysql and source commands.

Back up the database:

Enter cmd to export all databases: enter: mysqldump-u [database user name]-p-A > [path to save backup files]

Export data and data structure: enter: mysqldump-u [database user name]-p [database name to be backed up] > [save path of backup file]

Example: mysqldump-u root-p test > d:\ test.sql Note: this backup only backs up data and data structures, no backup stored procedures and triggers

Export data only but not data structure: enter: mysqldump-u [database user name]-p-t [database name to be backed up] > [save path of backup file]

Export the Events input in the database: mysqldump-u [database user name]-p-E [database user name] > [save path of backup file]

Export stored procedures and functions in the database mysqldump-u [database user name]-p-R [database user name] > [save path to backup file]

Import database mysql-u root-p

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