Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Fix the INSERT Command Denied Error
How To Fix the INSERT Command Denied Error? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts
✍: FYIcenter.com
The reason for getting the "1142: INSERT command denied" error is that your user accound does not have the INSERT privilege on the table or database. To resolve this error, you need to ask your MySQL DBA to grant you the right privilege.
Your DBA will need to run commands like these to grant you enough privileges :
GRANT INSERT ON fyi.* TO dev; GRANT UPDATE ON fyi.* TO dev; GRANT DELETE ON fyi.* TO dev; GRANT SELECT ON fyi.* TO dev; GRANT CREATE ON fyi.* TO dev; GRANT DROP ON fyi.* TO dev;
Once you got the right privileges, run the following tutorial scrip again:
<?php include "mysql_connection.php"; $sql = "INSERT INTO fyi_links (id, url) VALUES (" . " 101, 'dev.fyicenter.com')"; if (mysql_query($sql, $con)) { print(mysql_affected_rows() . " rows inserted.\n"); } else { print("SQL statement failed with error:\n"); print(mysql_errno($con).": ".mysql_error($con)."\n"); } $sql = "INSERT INTO fyi_links (id, url) VALUES (" . " 102, 'dba.fyicenter.com')"; if (mysql_query($sql, $con)) { print(mysql_affected_rows() . " rows inserted.\n"); } else { print("SQL statement failed with error:\n"); print(mysql_errno($con).": ".mysql_error($con)."\n"); } mysql_close($con); ?>
The script should return this:
1 rows inserted. 1 rows inserted.
2007-05-10, 5330👍, 0💬
Popular Posts:
How To Change System Global Area (SGA)? - Oracle DBA FAQ - Introduction to Oracle Database 10g Expre...
Can we use the constructor, instead of init(), to initialize servlet? Yes , of course you can use th...
How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters? Unicode requires 1...
Can you prevent a class from overriding ? If you define a class as “Sealed” in C# and “NotInheritab...
What is the purpose of finalization? The purpose of finalization is to give an unreachable object th...