This article describes how to export and import .sql files under Linux commands. Share with you for your reference, the details are as follows: 1. Export the database using the mysqldump command (note the installation path of mysql, which is the path of this command): 1. Export data and table structure: mysqldump -u username -p password database name> database name.sql #/usr/local/mysql/bin/mysqldump -uroot -p abc > abc.sql After pressing Enter, you will be prompted to enter a password 2. Export only the table structure mysqldump -u username -p password -d database name> database name.sql #/usr/local/mysql/bin/mysqldump -uroot -p -d abc > abc.sql Note: /usr/local/mysql/bin/ ---> mysql data directory 2. Import database 1. First create an empty database mysql>create database abc; 2. Import database Method 1: (1) Select a database mysql>use abc; (2) Set the database encoding mysql>set names utf8; (3) Import data (pay attention to the path of the sql file) mysql>source /home/abc/abc.sql; Method 2: mysql -u username -p password database name < database name.sql #mysql -uabc_f -p abc < abc.sql The second method is recommended for importing. Note: There is a command line mode and sql commands The above is the editor's method of exporting and importing .sql files under the Linux command. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
>>: WeChat applet learning wxs usage tutorial
Unfortunately, the MYSQL_DATA_TRUNCATED error occ...
This article shares the specific code of JavaScri...
Table of contents 1. The default focus is on the ...
This article shares the specific code for JavaScr...
This article shares the installation and configur...
Table of contents 1. Baidu Map API Access 2. Usin...
Table of contents 1. Scene introduction 2 Code Op...
Table of contents 1. The writing order of a compl...
1. Prepare a new disk and format it with the same...
Table of contents What is maintainable code? Code...
<br />Previous Web Design Tutorial: Web Desi...
1.vue packaging Here we use the vue native packag...
Preface Recently, due to work reasons, I was work...
I recently encountered a problem. The emoticons o...
Problem Description After installing Qt5.15.0, an...