mysqldatabasestored-procedurescommand-line

Execute MySQL Stored Procedure using Command Line


Please help me out to execute a MySQL Stored procedure in command line, where the procedure contains conditional statements..


Solution

  • $ mysql --user=user_name --password=your_password db_name
    
    mysql> call stored_procedure_name();
    

    or

    $ mysql --user=user_name --password=your_password db_name < script.sql
    

    where script.sql contains your sql statement:

    call stored_procedure_name();