Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the sql statement of a single stored procedure exported by mysql

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to write the sql statement that mysql exports a single stored procedure. I hope you will gain a lot after reading this article. Let's discuss it together.

In mysql, you can use the "mysqldump-uroot-p-hlocalhost-P3306-n-d-t-R DBName > procedurename.sql" statement to export a single stored procedure.

View the contents of the specified stored procedure:

Select body from mysql.proc where name='procedurename'

View all stored procedures:

Show procedure status

Export stored procedures for MySQL

Mysqldump-uroot-p-hlocalhost-P3306-n-d-t-R DBName > procedurename.sql

Parameter description:

-n:-- no-create-db

-d:-- no-data

-t:-- no-create-info

-R:-- routines Dump stored routines (functions and procedures)

Introduction of main parameters:

Character set option

-- default--character-set=xx

Connection option

-uthmum, Murphy, username,

-pmam Musi passwordroomname

-hmm. color, color, etc.

-PMAE, music, and portals #

Output content options

-- add-drop-database

-- add-drop-table

-ntra, muri, no, create, db.

-ditto, murmur, Murphy, data

-t / t / m / w / w / b / w / w / w

Output format option

-- compact

-c-- complete-insert

-T (specify that the data in the data table is backed up as two files: simple data file and table SQL)

Note the xx.sql table creation file is created by root users of linux

The xx.txt file is created by a linux mysql user.

Therefore, the storage path of these two files must ensure that mysql users have permission to read, write and create files.

-- fields-terminated-by=name (domain delimiter)

-- fields-enclosed-by=name (domain reference)

-- fields-optionally-enclosed-by=name (optional characters for domain references)

-- fields-escaped-by=name (escape character)

Other

-F-- flush-logs (refresh log before backup)

-l-- lock-tables (add read locks to all tables)

Import stored procedures for MySQL

Mysql-hhostname-uusername-ppassword databasename < backupfile.sql after reading this article, I believe you have some understanding of how to write the sql statement of a single stored procedure exported by mysql. You want to know more about it. Welcome to follow the industry information channel. Thank you for reading!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report