I have encountered some unexpected behavior with MySQL server 5.6.26.
mysql is hosted on Windows 7 Enterprise 64-bit SP1.
I have a schema which contains some stored procedures. If I drop the schema and create it again the procedures still magically exist.
The stored procedures in question aren't visible in information_schema.routines nor mysql.proc.
The situation is even worse because when I try to drop the procedures with DROP PROCEDURE I get error that they don't exist (Error code 1305). On the other hand I am unable to create a new procedure with the same name (Error code 1304).
Restart of the service doesn't help.
I am interested in why is this happening. I can see the stored procedures listed in MySQL Workbench in the Navigator window. Where can possibly the stored procedures be kept?
This was fixed by running:
mysqlcheck --auto-repair -A -u username -ppassword
Related
I'm working wint a restAPI using java JaxRS and mysql with phpmyadmin in the server side. I have about 75 stored procedures in the database, and it disappeared from the editor view. The already existing procedures are still exist in the default mysql db (prod table) and the software can call them, but there is no chance to edit them. If i create a new procedure, it also created in the mysql-> prod table, but still not visible in the mysql view, and also dropp an 500 internal server error, referencing the database lost the connection with the server while the procedure was created.
Is there any advice to make it work normal again?
I'm trying to create stored procedures for my teammates who are non-technical and can't write MySQL queries on their own.
They are currently accessing the database through phpMyAdmin.
However, when I create stored procedures, my teammates are unable to execute them from phpMyAdmin. They see the procedures, but the "execute" command is absent and everything else is grayed out. Here's an example with a stored procedure named get_transaction_history:
To be sure, I gave my teammates the permission to execute the stored procedure with the following command:
GRANT EXECUTE ON PROCEDURE database.get_transaction_history TO 'teammate1'#'localhost';
And indeed, it's possible for them to execute the stored procedure through the CALL command. However, phpMyAdmin won't allow them to execute the stored procedure from its GUI. Yet, it claims that my teammates do have the EXECUTE option granted to them.
Anyone knows what's going on?
There are separate user privileges within phpMyAdmin to the DB itself.
Go to the phpMyAdmin homepage and click Privileges and check that the users have the privileges required to execute the stored procedure.
You are most probably facing this bug https://github.com/phpmyadmin/phpmyadmin/issues/14430
It was fixed in phpmyadmin version 5.10
Solution: check your version and upgrade.
I'm using MySQL Workbench and have had the following issue happen a number of times to me now.
If I'm altering a Stored Procedure, and workbench freezes or I need to restart workbench for whatever reason, then sometimes when I connect back to my DB, the stored procedure no longer exists.
I'm in Workbench 8.0.19 but same has happened in earlier versions as well.
Anyone have an idea why, or more importantly how to avert such happening?
I have hosted a website in godaddy with php/mysql/apache. Now I want to create stored procedure in mysql but find that no options in cPanel for me to do. When I just paste the create sql in cPanel SQL window, it said it need super privileges to do that. After google in the website, it said I can remote connect to godaddy mysql and create in my mysql console workbench. But when I setup in the mysql console, it said it cannot connect after test connection. What should I do? What is the correct steps to do that??
Just make sure your stored procedures are labeled as DETERMINISTIC.
This is an example of an allowed stored procedure form Godaddy help pages :
DELIMITER $$
DROP PROCEDURE IF EXISTS `spGetSouls`$$
CREATE PROCEDURE `spGetSouls`()
DETERMINISTIC
BEGIN
SELECT * FROM soul;
END$$
DELIMITER ;
CALL spGetSouls();
There might be something wrong with your account- I was able to create stored procedures on mine. In cPanel, I picked phpMyAdmin and selected on of my databases. There'll be a "Routines" tab showing. I created a new routine (type of procedure) to create a stored procedure and it saved successfully. If this isn't working for you, I'd suggest opening a support ticket
Using MySQL work bench would be the best option. You should be able to connect with the same hostname/IP that shows in cPanel. Try opening a command prompt and running the following:
telnet <cpanel_account_ip> 3306
That should be working (just tested and mine works great). If it's not, you might have a firewall rule blocking it. When you use Workbench, make sure you connect with the database user defined under the MySQL databases. You may need to associate that user with the database (which you can also do from the MySQL databases page in cPanel).
Let us know how it works out!
I found tutorials on creating a stored procedures on the net, I just don't understand when exactly do I need to execute the creation of the stored procedure.
do the stored procedures creation should be executed each time i restart my MySQL server ?
do I need to execute the stored procedures creation sql each time I start my application?
Stored procedures are persisted to the database, ie they will be there even after a restart of the database server. You create them once and then you run them as often as you need. Of course you may want to change them sometimes using an alter statement.