Skip to content

Instantly share code, notes, and snippets.

@shakhmehedi
Created September 1, 2016 15:19
Show Gist options
  • Save shakhmehedi/d6ff5b17566ec9cfb0f93357fb7924bb to your computer and use it in GitHub Desktop.
Save shakhmehedi/d6ff5b17566ec9cfb0f93357fb7924bb to your computer and use it in GitHub Desktop.
MySQL Command Examples

MySQL Command Examples

#Stored procedure and function ##Bulk delete stored procedure

delete from mysql.proc WHERE db LIKE 'yourDbName';

##mysqldump/backup stored procedure only

mysqldump -h... -u... -p... -n -d -t --routines --triggers --all-databases > MySQLStoredProc.sql

  -n, --no-create-db  Suppress the CREATE DATABASE ... IF EXISTS statement that
                      normally is output for each dumped database if
                      --all-databases or --databases is given.
  -d, --no-data       No row information.
  --triggers          Dump triggers for each dumped table.
                      (Defaults to on; use --skip-triggers to disable.)
  -R, --routines      Dump stored routines (functions and procedures).

More on stack overfollow ##Difference between procedures and functions The most general difference between procedures and functions is that they are invoked differently and for different purposes:

  1. A procedure does not return a value. Instead, it is invoked with a CALL statement to perform an operation such as modifying a table or processing retrieved records.
  2. A function is invoked within an expression and returns a single value directly to the caller to be 3. used in the expression. You cannot invoke a function with a CALL statement, nor can you invoke a procedure in an expression.

More on stackoverfllow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment