In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is to share with you about how to import and export MySQL table structure, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Import and export of MySQL table structure
Import and export of MySQL structure:
The path under Linux can be changed, for example, the table structure of database gaomart is exported:
Mysqldump-d-uroot-p123456 gaomart > d:/gaomart.sql in Windows
Mysqldump-d-uroot-p123456 gaomart > / home/liangjian/gaomart.sql in Linux
If you don't add-d, all the data and table structures are imported. Add-d to export only the table structure.
1. Enter cmd while running to enter the dos command window
2. Enter the bin directory under the installation directory of mysql
3. Enter mysqldump-u root-p-d database > d:/gaomart.sql
4. Then enter the password and enter.
Import:
Import the data and table structure of mysql under windows system:
1. Enter the Mysql Command Line Client of mysql
2. Enter the password and enter.
3. Enter use database before entering enter
4. Enter source d:\ gaomart.sql and enter enter.
The path under Linux is different. For example, enter source / home/liangjian/gaomart.sql before entering enter.
--
1.MySQL command import
Mysql-h server address-P port-u user name-p database name
< 文件名.sql 有时候由于数据库字符集的问题会出现ERROR at line : Unknown command '\''.这时只要在命令加 --default-character-set=utf8 就可以解决了。 备注:"-P 端口"这个参数,如果服务器使用默认的3306端口,则可以忽略! 是否与上面的问题有关 1.导出整个数据库 mysqldump -u用户名 -p密码 数据库名 >Exported file name
C:\ Users\ jack > mysqldump-uroot-pmysql sva_rec > e:\ sva_rec.sql
two。 Export a table, including table structure and data
Mysqldump-u user name-p password database name table name > exported file name
C:\ Users\ jack > mysqldump-uroot-pmysql sva_rec date_rec_drv > e:\ date_rec_drv.sql
3. Export a database structure
C:\ Users\ jack > mysqldump-uroot-pmysql-d sva_rec > e:\ sva_rec.sql
4. Export a table with only table structure
Mysqldump-u user name-p password-d database name table name > exported file name
C:\ Users\ jack > mysqldump-uroot-pmysql-d sva_rec date_rec_drv > e:\ date_rec_drv.sql
5. Import database
Common source commands
Go to the mysql database console
Such as mysql-u root-p
Mysql > use database
Then use the source command, followed by a script file (such as .sql used here)
Mysql > source d:wcnc_db.sql
The above is how to import and export the MySQL table structure. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.