godaddy create stored procedure in mysql hosting - mysql

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!

Related

Mysql stored procedures are invisible, but still exist and working in application level

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?

Is there a way to change the permissions required for a Stored Procedure via mysqlworkbench?

I am trying to create a stored procedure with MYSQL for Visual Studio2019. I wrote a little "stub" just to make sure that I can develop it before I start writing the real code.
I have connected to the database (it is up on RDS) and I can see it in the Server Explorer. When I try debugging it with Debug Mysql Routine I get an Error while debugging. Access denied you need SUPER, SYSTEM...
So I see I can do this with GRANT EXECUTE... But where do I run this? I don't have access to a CLI on the RDS server? Is there some way to set this up in either Mysql for benchVS2019 or in Mysql Workbench?
I managed to solve this myself. I first needed to load mysql onto the EC2 instance I am using. Once I did that I was able to GRANT PRIVILEGES.

Cannot execute a stored procedure from phpMyAdmin

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.

Ping website from MySQL Stored Procedure

I'm hosted a MySql database on Amazon RDS, and I'm looking to create a Stored Procedure that will ping my NAS at home and log the results to a table. I'm looking to create a log of my home internet outages.
I'm new to MySql and have no idea how to ping something from a Stored Procedure, and every search on google appears to be on how to ping a MySql server, not how to ping from a MySql stored procedure.
In mssql I can ping using the following method:
DECLARE #pingAddress VARCHAR(200) = 'ping www.google.ca'
EXEC master..xp_cmdshell #pingAddress
Is there anyway to achieve the same affect in MySql?
You shouldn't ping or do anything else outside the database in a stored procedure. Stored procedures are for manipulating data in MySQL.
If you want to log your home internet outages, there are services that do that for you, for example https://www.pingdom.com/free
If you prefer to do it yourself with custom code, write an application and host it on a small EC2 instance, or else run a Lambda function on a schedule or something like that.
Here's a blog about how one person did it with a Lambda: https://medium.com/#nzoschke/http-service-health-monitor-w-lambda-a9f475abbbf4
In a native MySQL unextended by user-defined functions, You Can't Do Thatâ„¢.
There may be a suitable set of user-defined functions if you must do it. But doing this sort of thing within a MySQL database is something zealously to be avoided.
Here is the UDF repository.
https://github.com/mysqludf

How to create trigger through phpmyadmin?

On my wamp server I have a version of phpMyadmin that allow me to create trigger through the interface.
But on my server from OVH The option is not there, so I try tu update almost everything I can ( mysql, phpmyadmin ) wich now seem to be the same as my local installation. But I stil can't do that operaion.
When I compare both version there is some differences in the table informations_schema but I don't know what to do to fix that problem.
can someone help ?
phpMyAdmin only displays this option if your MySQL server supports triggers (MySQL 5.0.2 and above) and if your user is allowed to create triggers (he needs "TRIGGER" privilege). You can check your privileges by querying "SHOW GRANTS" in the SQL query box in phpMyAdmin. Maybe your provider doesn't want you to use triggers.
If your user have rights to create triggers try to use CREATE TRIGGER Syntax
Or use Devart dbForge Studio - the best tool for mysql