Dump just the table structure to a file in MySQL Dump chỉ là cấu trúc bảng vào một tập tin trong MySQL
For this exercise, we will use the mysqldump utility the same as if we were Để thực hiện điều này, chúng tôi sẽ sử dụng tiện ích mysqldump giống như nếu chúng tôi đã được backing up the entire database. sao lưu toàn bộ cơ sở dữ liệu.
Syntax: Cú pháp:
mysqldump -d -h localhost -u root -pmypassword databasename > dumpfile.sql mysqldump-d-h localhost-u root-pmypassword databasename> dumpfile.sql
The only option that is different than creating an entire backup is the -d switch, which tells mysqldump not to output the data. Các lựa chọn duy nhất là khác với việc tạo một sao lưu toàn bộ là-d chuyển đổi, mà nói với mysqldump không xuất dữ liệu.
Example: Ví dụ:
mysqldump -d -h localhost -u root -p2Uad7as9 database01 > dumpfile.sql mysqldump-d-h localhost-u root-p2Uad7as9 database01> dumpfile.sql

Daily Email Updates Email cập nhật hàng ngày
You can get our how-to articles in your inbox each day for free. Bạn có thể làm thế nào chúng tôi vào các bài viết trong hộp thư của bạn mỗi ngày miễn phí. Just enter your name and email below: Chỉ cần nhập tên và email của bạn dưới đây:



– --
–Use this to take only the Table structure of the database table in Linux – -Sử dụng để chỉ những cấu trúc Table của bảng cơ sở dữ liệu trong Linux --
On the terminal Trên thiết bị đầu cuối
[root@localhost ~]# mysqldump -uroot -proot123 -h200.200.200.12 mydatabasename tbl_mytable_name –no-data > /tmp/tbl_mytable_name_dump.sql [root @ localhost ~] # mysqldump-uroot-proot123-h200.200.200.12 mydatabasename tbl_mytable_name-không có dữ liệu-> / tmp / tbl_mytable_name_dump.sql
Remember , if u dont redirect it to a file, it will stores the dump at pwd by the name “oot” Hãy nhớ rằng, nếu u dont chuyển hướng nó vào một tập tin, nó sẽ cửa hàng tại các bãi chứa pwd bằng cái tên "oot"
Regards, Kính trọng,
Girish Girish
u can restore it in the database using ,,,, u có thể khôi phục lại trong cơ sở dữ liệu bằng cách sử dụng,,,,
mysql > source /path/to/a/dump/file mysql> source / path / to / a dump / / file
Thanks. Cảm ơn. It helps! Nó giúp!
ok, say you have two dbs very similar in structure. ok, nói rằng bạn có hai dbs rất giống nhau trong cấu trúc. one you use as a master template which goes through various revisions, let's say we're now on revision 3. một bạn sử dụng như là một bậc thầy mẫu mà đi qua phiên bản khác nhau, chúng ta hãy nói rằng bây giờ chúng tôi đang xem xét lại 3. but the second db is a copy of the template as it was at revision 1. nhưng db thứ hai là một bản sao của mẫu như là nó đã được sửa đổi tại 1.
because db 2 is in use, you don't want to drop any tables, but you do need to update the structure of the entire db to the latest version of db 1. vì 2 db đang được sử dụng, bạn không muốn thả bất kỳ bàn, nhưng bạn cần phải cập nhật các cấu trúc của db toàn bộ phiên bản mới nhất của db 1.
is there any method of doing this without having to manually go through and make all the same changes again and again (over many dbs at various versions) and without losing any of the data? là có bất kỳ phương pháp làm điều này mà không cần phải tự đi qua và làm cho tất cả những thay đổi cùng một lần nữa và lần nữa (trên dbs nhiều tại các phiên bản khác nhau) và mà không mất bất kỳ dữ liệu?