Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

Help! MySQL guru req'd

Status
Not open for further replies.
Joined
Apr 20, 2006
Posts
2,004
Reaction score
82
I need someone to delete data from a table within the database.

When I take a look at the table through webmin it states "Data in this table cannot be edited because it has no primary key" So it needs to be done through ssh, which i have very little knowledge of.

I know it is a 5min job, but I will pay someone to do this for me, and they can give me the commands i need to do it in future.

Can you help me?

.
 
just because it has no primary key doesn't mean that you can't delete things.

Add a primary key field to teh table, and then you should have more success
 
If your really stuck install phpmyadmin.. gives you web based gui that talks you through everthing
 
Thanks folks.

The table has 19 fileds in it. I tried to add a primary key to the 1st one and it came back with an error message.

phpmyadmin:
I took a look and i will install. (Looks good!) but I need this done today.

The fix I am looking for is quick and something along the lines of:

cd mysql
delete from table



But I am not willing to do it myself as it is a live database. So i need someone that can do this sort of thing with their eyes shut. I will stick a post on scriptlance as well.

Thanks again

.
 
do you need the entire table emptied?

if so:

from shell:

mysql -u user -p
<enter password>
USE database;
TRUNCATE table;

that should do it - you can just stick 'TRUNCATE table' into the webmin sql box for that table too - but it will delete all rows!
 
thanks jeewhizz.
yes I need the entire table emptied.

When you connect to the database, how do you direct to the table?

the table name is: global_send


thanks
 
Doh!

USE database = USE name of database.

Sorry for the lamer and a very BIG thank you. It worked a treat. Table now empty! :-D :-D :-D

.




do you need the entire table emptied?

if so:

from shell:

mysql -u user -p
<enter password>
USE database;
TRUNCATE table;

that should do it - you can just stick 'TRUNCATE table' into the webmin sql box for that table too - but it will delete all rows!
 
I've just put a few more words around what jeewhizz said:

You might need to move to the directory where mysql is; usually mysql/bin then type:
mysql -u username -p

replace username with a database user with appriopriate permissions, this might be the login name for the web-account or might be "root"

You will then be prompted for a password.

You'll now see the prompt change to something like MYSQL>


then type:

USE yourdatabasename;
TRUNCATE global_send;


===
Edit: too late - never mind.
 
You might need to move to the directory where mysql is; usually mysql/bin then type:
mysql -u username -p

What would that accomplish?

Typing

mysql

will just load mysql from the main bin paths - it won't load it from the directory where you are - you'd need to type ./mysql for that
 
reading the thread from start to finish, just remember there's a world of difference (&pain!) between deleting a table and emptying (truncating) table.

Get the question right first! ;)

S
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Featured Services

Sedo - it.com Premiums

IT.com

Premium Members

AucDom
UKBackorder
Be a Squirrel
Acorn Domains Merch
MariaBuy Marketplace

New Threads

Domain Forum Friends

Other domain-related communities we can recommend.

Our Mods' Businesses

Perfect
Service
Laskos
*the exceptional businesses of our esteemed moderators
Top Bottom