Home >Database >Mysql Tutorial >How to use mysql command to import and export sql files under Linux

How to use mysql command to import and export sql files under Linux

WBOY
WBOYforward
2023-05-26 12:16:061835browse

During daily development, import and export operations of the database cannot be avoided.

How to use mysql command to import and export sql files under Linux

Use the command directly:

 mysqldump -u root -p abc >abc.sql

Then press Enter to enter the password;

mysqldump -u database link username -p Target database> The stored file name

The file will be exported to the current directory

Import database (sql file)

mysql -u username-p database name mysql - u abc -p abc

Note that the sql file must be in the current directory. If it is not in the current directory, it needs to be in

The above is the detailed content of How to use mysql command to import and export sql files under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete