?
Solved

problem with php script - truncate table - continued

Posted on 2010-08-23
8
Medium Priority
?
569 Views
Last Modified: 2013-12-13
Greetings,

This is a follow on question to http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_26422114.html

I get this sql error message:

DROP command denied to user 'themaury_reapp'@'localhost' for table 'features_tab'

This has been occuring since I moved this site to a new server.  So I think I need to modify some permissions.

Can anyone advise me?

Thanks very much.

Sky
0
Comment
Question by:Schuyler Kuhl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 33500846
>  So I think I need to modify some permissions.
yes. either your new host allows you to grant the "drop table" permission to the login you use to connect (which should not be a problem, as you also create the tables, right?) , or you change the "truncate table" into a "delete tablename" ...
0
 
LVL 3

Expert Comment

by:grantunwin
ID: 33500895
Use thoe following SQL statement

"GRANT DROP ON features_tab TO themaury_reapp";
0
 

Author Comment

by:Schuyler Kuhl
ID: 33500944
Does delete remove the data of the table and retain the structure?

Also isn't drop actually used to delete the table completely?  

I use cpanel but I can't see where to modify these permissions. You can just add a user to the database but I don't see that there are any further settings for that user.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33500982
>Does delete remove the data of the table and retain the structure?
yes.
truncate table does the same, but requires the drop table permissions ...
0
 

Author Comment

by:Schuyler Kuhl
ID: 33501058
Ok I just looked it up.  I see that the delete command can be used to just delete specific records.

mysql_query("DELETE FROM example WHERE age='15'")

Would this delete all records: mysql_query("DELETE FROM example'")

Is there a limitation to the number of records?

thank you.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33501129
>Would this delete all records: mysql_query("DELETE FROM example'")

yes

>Is there a limitation to the number of records?

no
0
 
LVL 11

Accepted Solution

by:
RedLondon earned 1000 total points
ID: 33501220
To use cPanel to grant the permission to DROP, or just to see which permissions your user has, log into www.your-site.com/cpanel with your account username and password (ie the same details you'd use for FTP - not the MySQL username/password)

Click on the "MySQL Databases" icon in the "Databases" box

There's a table that shows your databases, the first column lists the database names, the second the usernames with access to that database, and then a Delete Database link in the third column

Click the username beside the database you're working with (the username itself, not the red cross beside it)

You now see a list of checkboxes showing the permissions you have, and can select from SELECT, CREATE, INSERT, ALTER, UPDATE, DROP, DELETE, LOCK TABLES, INDEX, REFERENCES, CREATE TEMPORARY TABLES, & CREATE ROUTINE as necessary, or select 'ALL PRIVILEGES' if necessary.
0
 

Author Comment

by:Schuyler Kuhl
ID: 33501277
Outstanding. Thanks very much. I don't know how I overlooked this earlier.

Thanks very much.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question