Importing a MySql procedure in PHPMyAdmin

If you have created a procedure in mySql database and want to create same on another server then you should checkout this blog.

If you try to export entire database and import it in another server, then all tables and views will be created exactly same but procedure and functions will not be created.

I will tell you an easy way to import a procedure through PHPMyAdmin.

First check all created procedures by this command –

Result will be like –

It show that there is one procedure named “create_supporting_tables“.

Now you need to see create query of the procedure by using this command –

Output of the query will be like:-

So, you can find create procedure query which is –

Now you have to break this create statement in parts

  • Definer – root@localhost
  • Routine Name – create_supporting_tables
  • Routine Type – Procedure
  • Parameters – IN – user_id -INT(11)
  • Definition – All query from keyword ‘BEGIN’ to ‘END’
  • SQL Data Access – NO SQL

 

Open phpMyAdmin and select database then click on Routines >> Add routine.

You will see a form in a pop-up, like

 

Fill the form as the values taken from the create query  like

Click on Go button and your procedure will get added into your database.

Read our block about Altering a database view by Laravel Migration.

Please follow and like us:
20

Leave a Reply