Link to home
Start Free TrialLog in
Avatar of SummitDan
SummitDan

asked on

MySQL Error: #1307 - Failed to CREATE PROCEDURE

I'm trying to create a procedure using the same syntax successfully used on a different server with the same version of MySQL.  This is a new LAMP server (CentOS 5.2) so mysql may not be configured correctly.  I've checked the permissions in /var/lib/mysql and they look fine.

What configuration options might I need to change?

I've read some suggestions that mysql be reinstalled.  I'd rather not do that obviously, but if I must, how can I do this in a thorough manner?

Thanks for any feedback.
Avatar of Emad Gawai
Emad Gawai
Flag of United Arab Emirates image

check if there is something in Error log
Avatar of dmonzon
dmonzon

verify your servers (MySQL,PHP, etc) versions
or post your code
Avatar of SummitDan

ASKER

I'm having trouble finding the error log.  According to
http://dev.mysql.com/doc/refman/5.1/en/error-log.html
the error log should be in the /var/lib/mysql directory with the .err extension, but i'm only seeing ib_logfile0, ib_logfile1.

I'm using
mysql Ver 14.14 Distrib 5.1.32 for redhat-linux-gnu (i686) using readline 5.1
and
PHP 5.2.9 (cli)
Check on your mysql configuration, if you have error log on, if you specify a name for it (hostname.err is the default) and the location of it.

http://dev.mysql.com/doc/refman/6.0/en/error-log.html
I've found the log for my installation in /var/log/mysqld.log.  I'm not noticing any errors when I attempt to create the procedure, but there are some errors when mysql is started:

090403 12:05:55 [Note] /usr/libexec/mysqld: Normal shutdown

090403 12:05:55  InnoDB: Starting shutdown...
090403 12:05:56  InnoDB: Shutdown completed; log sequence number 0 43665
090403 12:05:56 [Warning] Forcing shutdown of 2 plugins
090403 12:05:56 [Note] /usr/libexec/mysqld: Shutdown complete

090403 12:05:56 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
090403 12:05:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
090403 12:05:57 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
090403 12:05:58  InnoDB: Started; log sequence number 0 43665
090403 12:05:58 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
090403 12:05:58 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Created with MySQL 50045, now running 50132. Please use mysql_upgrade to fix this error.
090403 12:05:58 [ERROR] mysql.user has no `Event_priv` column at position 29
090403 12:05:58 [ERROR] Cannot open mysql.event
090403 12:05:58 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
090403 12:05:58 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.32'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL) by Remi

I tried running mysql_update, but I'm getting this:

Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck'...
mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
FATAL ERROR: Upgrade failed

Is there a way to specify a password when running mysql_upgrade?  From the man page this doesn't seem to be the case.


I've sucessfully run mysql_update (thanks dmonzon), and there are no longer any errors appearing in the log, just the warning 'Forcing shutdown of 2 plugins'.

Now I'm getting a different error:

#1607 - Cannot create stored routine `calcResTotals`. Check warnings

Running
SHOW WARNINGS;
from the command line as the same user and using the same database returns an empty result set.  Is this the correct way to view warnings?

I've been trying to create the procedure from phpMyAdmin, but also from the command line and from a php script.  They all produce the same result.

Referencing this issue:
https://www.experts-exchange.com/questions/23207493/i-can-not-get-CREATE-PROCEDURE-to-work-corectly.html

I've attempted setting sql_mode = '' both in the my.cnf file and directly from the command line.  Still no joy.
I'm thinking this issue must pertain to my initial installation of the PHP/MySQL package.  I did this using the remi repository, following the guide at:
http://timt881.wordpress.com/2009/02/17/installing-phpmyadmin-and-php-52-on-a-centos-52-server/

Has any one else had success using this repository and/or PHP 5.2.9 with stored routines?
ASKER CERTIFIED SOLUTION
Avatar of SummitDan
SummitDan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial