views:

806

answers:

3

My attempts to query MySQL from PHP with a create statement of a store procedure (SP) have all failed. Is this not possible ?

If indeed possible, please give an example.

A: 

Have you got sufficient privileges on the account you are connecting from PHP with? From the manual

As of MySQL 5.0.3, to execute the CREATE PROCEDURE or CREATE FUNCTION statement, it is necessary to have the CREATE ROUTINE privilege

See also Stored Routines and MySQL Privileges in the manual.

Paul Dixon
+2  A: 

As long as:

  • You're using MySQL 5.0+
  • Your account has been authorized for creating stored procedure
  • You're using the valid CREATE PROCEDURE syntax

Then it should be working. Check these and get back to us.

Allain Lalonde
A: 

The MySQL manual has a clear overview about how to create stored procedures.

The next question is: does the account you use to access the MySQL database the propper rights to actually create a procedure? Details about this question can be found here

Gerrit