Showing results for 
Show  only  | Search instead for 
Did you mean: 

INSERT command denied to insert data in DB

Hi, i am programmer and i have recently bought your Cpanel hosting for my website and i have uploaded my website on it. i am facing one problem that when i try to use insert query with MYSQLi with php it denies to insert in DB 


is there any solution ? 

update query is working fine.

Helper III

What error is mysql returning?


It sounds like a connection issue.

feel free to skype me yasmalik

please note that, i offer direct support that is in no way associated with GoDaddy's regular support channels; but, for immediate technical support you can contact me at:
Getting Started

Hi @yasmalik:

Another reason for failure to insert is that your database has a constraint (requirement) that is not being met with the record that you are trying to insert.

Is there a required field not being populated?

Is there a field that you are trying to insert the wrong data type?

Is there a field that requires specific data (perhaps a link to another table) that you are not populating with valid data?

Just a few things to consider.

Good luck,



Getting Started

I've been having this kind of problem for a very long time now and I'm still not sure how I can fix this. You see in mysqldatabase named examplebb I have 4 column named name, email, password, id(it is automatically generated so its not a problem) and diary. In my form I got name, email and password and I wanted to insert these three and its not letting me because of the diary column that I have and Updating a diary to my database is not letting me do it because of the three other columns and I basically don't know what to do on how to fix this plus I got Warning: mysql_real_escape_string() expects parameter 1 to be string, object given in /home/daltonnapala/public_html/mysql/updatediary.php on line and as I search in the internet it say its about the $query not being a string and when I changed it, it is the same.



hello @Dalten_OO,


I immediately noticed you are using outdated mysql. You should migrate to MySQLi or use PHP : PDO.


 your warning indicates that you are using mysql_real_escape_string incorrectly, see:

please note that, i offer direct support that is in no way associated with GoDaddy's regular support channels; but, for immediate technical support you can contact me at:

Cool! I can contact you anytime of the day or night? or does it have a specific time of the day or night. Plus thanks for the help!.

I am getting below error while inserting to my database. It was working till today morning.


ERROR - INSERT command denied to user 'schoolconnectdb'@'XXX.XX.XXX.XX'

Please check your user privileges


I have try to do an INSERT query using php. However, the is error as shown below.
"INSERT command denied to user "
Select query can work fine when we using php file. i try to access godaddy phpmyadmin(Manage Databases) insert query and I can insert data.
All of these operations are the same user name and password. Can't create/write to file '/tmp/mysqltmp/#sql_4ed9d_0.MYI' (Errcode: 13) SQL=SELECT b.rules FROM #__assets

check the privileges of that user

pretty hard to do when your administrator/root account has 0 permissions.

I seem to be having this problem also.


I created a database with phpmyAdmin and can enter/insert data with the "insert" option/tab. I'm unable to use an SQL statement to insert data. This is not a problem where I have another hosted account.


I look at the user_privileges for myself and they are "USAGE" which means I can do nothing. Logging into mysql through ssh as myself still I can't even grant myself the additional privileges of INSERTing data.


Any idea of how I can grant myself those privileges?


As gladgladwrap noted, "pretty hard to do when your administrator/root account has 0 permissions." which is no help at all.

I should follow up on what my issue was: I did not encounter an insert error due to my user permissions. If I recall correctly what my issue was, I was hashing a password and I encountered an insert error by trying to insert this hashed password into a field whose max string size was set to the max length I would accept in the password field of my form -- yes, a very silly mistake since a hash function pops out a hash of fixed size every time. So check the restraints set out by your table and make sure your query is correct such that you are inserting the correct data into the correct column with the correct size of data. 


I have only been rejected from certain queries within phpMyAdmin due to permissions:


"create database <dbname>" -- creating a database must be done inside cPanel.


Any queries granting or revoking privileges, or creating users: We are within a shared server and we are not the root user of this database. We are also not administrators since we don't have grant permissions or have access to the mysql database. (If anyone is looking for what their permissions are, go to the information_schema.USER_PRIVILEGES within phpMyAdmin.)


Also trying to add users to our /home/ via ssh is restricted. 

i'm a programmer. in  my host  simple insertion query is not working. please solve it as possible as.

before its been working properly but when my account get locked bcuz of the payment authentication(it is because my account is new and the name of credit card not match to my acc) and after i retrieve my domain and hosting(economy linux)  thru customer service. i go back from the top. upload files. create db. when i run my login.php that have only SELECT query it work fine but when i use my register.php that have INSERT query it wont work. and show no error, my db is still empty.


Sorry for my english and grammar


$result=mysqli_query($conn,"INSERT INTO `account` (fname,lname,username,password) VALUES ('".$fname."','".$lname."','".$username."','".$password."')");