In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
When mysqldump exports a stored procedure, there will be comments. However, when importing with the mysql command, comments are automatically filtered out if left unspecified. To import along with the comments, you can add the-- comment parameter.
Example:
Export stored procedures:
If% time:~0,2% lss 10 (
Set ymd=%date:~0,4%-%date:~5,2%-%date:~8,2%_0%time:~1,1%
) else (
Set ymd=%date:~0,4%-%date:~5,2%-%date:~8,2%_%time:~0,2%
)
Set date=%date:~0,4%-%date:~5,2%-%date:~8,2%
Set v_backup_file_name=xedk_%ymd%_bak.sql
Set v_backup_error_name=xedk_%ymd%_error.txt
Mysqldump-uroot-h292.168.2.154-P 3308-p "root"-- log-error=D:\ DBStruct_%v_backup_error_name%-ntd-R-- skip-triggers-f test > "D:\ DBStruct_%v_backup_file_name%"
Parameter description:
-- log-error logs errors during export in the path indicated by this parameter
-n is-- no-create-db, which only exports data without adding CREATE DATABASE statements
-t is-- no-create-info, which only exports data without adding CREATE TABLE statements
-d is-- no-data, which does not export any data, only the database table structure
-R is-- routines, which exports stored procedures and custom functions
-- masking triggers on skip-triggers export
-f forced export, even if there is an error in the middle will not be interrupted, skip the error to continue to guide.
Test, this is my test library name.
Summary: this command is to export the functions in the test library separately, without exporting the table structure and related data triggers.
(remarks:
Mysqldump-uroot-p "root"-ntd-R-- skip-triggers-f test > "D:\ DBStruct_test1.sql"
Only stored procedures are exported
Mysqldump-uroot-p "root"-td-R-- skip-triggers-f test > "D:\ DBStruct_test2.sql"
Only the stored procedure is exported, and the export result is no different from the above.
Mysqldump-uroot-p "root"-d-R-- skip-triggers-f test > "D:\ DBStruct_test3.sql"
Only table structures and stored procedures are exported
Mysqldump-uroot-p "root"-R-- skip-triggers-f test > "D:\ DBStruct_test4.sql"
Although the condition is that only the stored procedure is exported, the table structure is exported along with the table data.
Mysqldump-uroot-p "root"-- single-transaction-B test-- tables test_parm > "D:\ DBData_test.sql"
Export the table structure and table data of the table test _ parm in the test library, with-B indicating which database and-- tables indicating which table.
)
Import:
Mysql-uroot-p "root"-P 3308-comment test
< "D:\DBStruct_xedk_2016-10-11_02_bak.sql" 2>"D:\ XEDKDBbak\ errorDBSturct.txt"
Import the exported file into the test library and record the errors reported during the import in the file D:\ XEDKDBbak\ errorDBSturct.txt.
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.