I'm using MySQL 5.0 and I would like to know if there's a way to disable deletes on a table. As in, not make it possible for ANY user to delete anything from the tablets, only update and insert.
You can specify multiple tables in a DELETE statement to delete rows from one or more tables depending on the condition in the WHERE clause. You cannot use ORDER BY or LIMIT in a multiple-table DELETE .
To delete rows in a MySQL table, use the DELETE FROM statement: DELETE FROM products WHERE product_id=1; The WHERE clause is optional, but you'll usually want it, unless you really want to delete every row from the table.
If you want to delete a record from any MySQL table, then you can use the SQL command DELETE FROM.
Here's an example of a trigger:
DELIMITER $$
CREATE TRIGGER tr_table1_del BEFORE DELETE ON table1 FOR EACH ROW
BEGIN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'DELETE cancelled';
END $$
DELIMITER ;
Yes, see the MySQL manual for the GRANT syntax
Here is an example of what you want:
GRANT SELECT, INSERT ON mydb.mytbl TO 'someuser'@'somehost';
Which gives only SELECT
and INSERT
privilages to a specific user/host on a specified table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With