How to export and import stored procedures from phpmyadmin

Can you guys help me regarding stored procedures. When I export a stored procedure from phpmyadmin, it is set as

CREATE DEFINER=`root`@`localhost` PROCEDURE `c4mo_get_cities_prc`(IN `p_state_code` VARCHAR(3), IN `p_country_code` VARCHAR(3), IN `p_language_code` VARCHAR(3)) NO SQL BEGIN SELECT city_name, city_code FROM `c4mo_cities` WHERE enabled = 'Y' AND language_code = p_language_code AND state_code = p_state_code AND country_code = p_country_code; END 

And when I import it from phpmyadmin, it gives an error like

 #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 13 
+7
import php export stored-procedures phpmyadmin
source share
2 answers

Delete DEFINER = root @ localhost

in the local import area,

he will fulfill.

0
source share

It is quite simple if you use the phpmyadmin interface.

For export :

You will see a regular tab, since this tab will only be displayed when you already have at least one stored procedure.

Just click on the subroutines tab and you will see your stored procedure (for the db that you did).

Check the box below and then export. You just need to copy all the code and save it anywhere on the local machine with the file your_stored_procedure.sql .

For import:

Just select the database and import the stored procedure file your_stored_procedure.sql as above, since you usually import the .sql file (tables) for your db.

0
source share

All Articles