How to hide mysql stored procedure [closed] - mysql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
How to hide MySQL stored procedure:
Like with encryption is available in SQL Server Store procedure. I try to hide stored procedure to outside users

As documented under SHOW CREATE PROCEDURE Syntax:
This statement is a MySQL extension. It returns the exact string that can be used to re-create the named stored procedure. A similar statement, SHOW CREATE FUNCTION, displays information about stored functions (see Section 13.7.5.10, “SHOW CREATE FUNCTION Syntax”).
Both statements require that you be the owner of the routine or have SELECT access to the mysql.proc table. If you do not have privileges for the routine itself, the value displayed for the Create Procedure or Create Function field will be NULL.
Therfore, to prevent users from viewing the body of a stored procedure, ensure that:
they are not the owner of the sproc; and
they do not have access to the mysql.proc table.
You can read more about The MySQL Access Privilege System.

Related

What is best practice for deleting respective data into another tables. Mysql delete query OR mysql Triggers [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Mysql Delete query VS Mysql Triggers (which is fast option?)
Triggers if you want your DBA to be in control of the code.
Query if you want your programmers to be in control of the code.
To clarify:
If it's a trigger, then the implication is that it's part of the database design for things to work that way. i.e. the structure of the database depends on it working that way.
If it's query code, then the implication is that the action is part of your business logic, and not critical to the core structure of the DB.
As mentioned before, they are different things. From MSDN: "A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server"; whereas a DELETE is a DML statement, that is, statement to manipulate database records. In this case, used for removing database records from a table or view.

I couldn't understand importance of stored procedures [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Today i learned how to create stored procedures in MySQL.
DELIMETER //
CREATE PROCEDURE new(IN first INT)
BEGIN
SELECT * FROM table WHERE first_id= first;
END //
Lets say i created this and called it from PHP; CALL new('4');
or i wrote my sql command directly into PHP
$mysqli->query("SELECT * FROM table WHERE first_id= $first");
I have 20 sql commands in my PHP and i am doing them copy past into phpmyadmin as stored procedures. they are not descreasing. Now what i gain from stored procedure? Just a few letter? or??? Thanks for help.
Stored procedures are a good way for building a clean abstraction layer between what is going on in the database and your server side logic. In addition a stored procedure allows that you specify exactly what kind of data you are expexting (data type and possibly length) which can help to improve security in your application (at least at this "access data from database"-point).

How to set a user to edit and access a specific database table only? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
How to set a user to edit and access a specific database table only? is it possible? i am using vb.net and mysql as my database
If you are talking about mysql user permissions, then you should use:
GRANT SELECT, INSERT ON mydb.mytbl TO 'someuser'#'somehost';
Edit 1 : Adding Resource Links
You should consult the MySQL GRANT statement, and Access Privilege System documentation for more information on how this all works.
Make a user Table, perhaps called UserAccounts.
When login then select username and password from UserAccounts.
Make a condition, for username = admin and pass = admin then can do all query.
for username = guest and pass = guest then can do only query1.
and so on.
Databases and its tables permission, can be done via application based on query.
just specified your query and which user should run it
give some code, so we can see your progress

Talend: How to create a table in MySql DB and populate using CSV file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm working in Talend and trying to create a table using data from a csv file. The database already exists but it has no tables as I need to be able to create one using the Talend components. I am using MySQL.
I am seriously struggling to find tutorials on this. Please help!
It's quite a easy task nicely covered by the user manual, but let me give you some starting insights:
Define a database connection. This will give you the possibility to record a connection detail to the DB you can reuse. And it's easier to check, too --> http://www.etladvisors.com/2012/08/22/managing-multiple-db-env/
If you don't need dev/test/prod decoupling, you can follow just the first part of the tutorial
Now design your job like:
tFileDelimitedInput---->[some data transformation stuff]--->tMySqlOutput
Fill the "Schema" section of tFileDelimitedInput to match your CSV (columns, datatype); you'll need to fill some other parameters too (ie the separation char, the encoding...)
Finally, in tMySqlOutput select your just recorded db connection from the dropdown list and fill the table name. If you select "Create table if not exists" on Table Action parameter, the table will be automatically created following your Schema (if you need not nullable or PK conditions you must define it in your Schema as well)
Be careful! If you change the input schema coming from your tFileDelimitedInput component you need to sync the changes to your output schema (in tMySqlOutput). Talend should ask for it automatically. If it doesn't, you can click "Sync Schema" at any time inside tMySqlOutput

I need to be notified if a condition fails in my database [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a database with Tables and Stored Procedures( with lots of sql statements).
Once a week the Windows Task scheduler pulls data from a different source and saves it in a Database table B. I need to compare Table B with existing Table A and if the quantity of Table B is less than Table A, i need to be notified through Email or any other such process.
How can i do that? Please help me. I could nt get any information from the Net
You can create a sql job, and send mail in sql like this
if (Select COUNT(*) from A) != (select COUNT(*) from B)
begin
EXEC master.dbo.xp_sendmail
#recipients=N'x#x.com;y#x.com',
#message=N'Tables count different',
#subject=N'SQL Tables' ;
End
before send mail in sql you must set sql main and give permissin by
sp_configure 'SQL Mail XPs', 1;
I would personally write a .NET console app and run it as a scheduled task. The app will query the database and processes the results. If it passes, notify of the pass, if it fails, notify of the failure.