Access denied after create a function
Posted by:
RockV
Date: August 23, 2005 12:46AM
Hello,
I think that this could be a bug or something.
If someone knows what is happening please let me know.
I am using this MySQL.
MySQL-server-5.0.11-0
MySQL-devel-5.0.11-0
MySQL-client-5.0.11-0
First, I enter with root user and grant all to user prueba to database prueba:
centconet:~ # mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 201 to server version: 5.0.11-beta-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> GRANT ALL ON `prueba`.* TO `prueba`@localhost IDENTIFIED BY 'prueba';
Query OK, 0 rows affected (0.00 sec)
mysql> update user set Select_priv = 'Y', Insert_priv = 'Y', Update_priv = 'Y', Delete_priv = 'Y', Create_priv = 'Y', Drop_priv = 'Y', Execute_priv = 'Y' where User = 'prueba';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
Now, I enter to that database with the user prueba and create a function:
centconet:~ # mysql -h localhost -u prueba -pprueba prueba
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 202 to server version: 5.0.11-beta-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> DROP FUNCTION fn_split_number;
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter //
mysql> CREATE FUNCTION fn_split_number(in_numero VARCHAR(50)) RETURNS VARCHAR(50)
-> BEGIN
-> DECLARE xDosPuntos, xArroba INT;
-> DECLARE xResultado VARCHAR(50);
-> SELECT INSTR(in_numero,':') INTO xDosPuntos;
-> SELECT INSTR(in_numero,'@') INTO xArroba;
-> SELECT SUBSTRING(in_numero, xDosPuntos + 1, xArroba - xDosPuntos - 1) INTO xResultado;
-> RETURN xResultado;
-> END
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
mysql> exit
Bye
Last, I try to enter to the database again and can't.
centconet:~ # mysql -h localhost -u prueba -pprueba prueba
ERROR 1045 (28000): Access denied for user 'prueba'@'localhost' (using password: YES)
Thanks for for your help.
RockV