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

Help! MySQL guru req'd

Discussion in 'Services Wanted' started by scooter, Jun 28, 2007.

Thread Status:
Not open for further replies.
  1. scooter United Kingdom

    scooter Well-Known Member

    Joined:
    Apr 2006
    Posts:
    2,004
    Likes Received:
    41
    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?

    .
     
  2. Jeewhizz

    Jeewhizz Well-Known Member

    Joined:
    May 2006
    Posts:
    1,174
    Likes Received:
    18
    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
     
  3. aquanuke

    aquanuke Well-Known Member

    Joined:
    May 2005
    Posts:
    2,040
    Likes Received:
    42
    If your really stuck install phpmyadmin.. gives you web based gui that talks you through everthing
     
    • Like Like x 1
  4. scooter United Kingdom

    scooter Well-Known Member

    Joined:
    Apr 2006
    Posts:
    2,004
    Likes Received:
    41
    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

    .
     
  5. Jeewhizz

    Jeewhizz Well-Known Member

    Joined:
    May 2006
    Posts:
    1,174
    Likes Received:
    18
    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!
     
    • Like Like x 1
  6. scooter United Kingdom

    scooter Well-Known Member

    Joined:
    Apr 2006
    Posts:
    2,004
    Likes Received:
    41
    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
     
  7. scooter United Kingdom

    scooter Well-Known Member

    Joined:
    Apr 2006
    Posts:
    2,004
    Likes Received:
    41
    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

    .




     
  8. mishmash

    mishmash Active Member

    Joined:
    Jan 2005
    Posts:
    160
    Likes Received:
    12
    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.
     
    • Like Like x 1
  9. scooter United Kingdom

    scooter Well-Known Member

    Joined:
    Apr 2006
    Posts:
    2,004
    Likes Received:
    41
    Thank you for taking the time mishmash.

    .
     
  10. Jeewhizz

    Jeewhizz Well-Known Member

    Joined:
    May 2006
    Posts:
    1,174
    Likes Received:
    18
    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
     
  11. tifosi United Kingdom

    tifosi Well-Known Member

    Joined:
    Oct 2004
    Posts:
    3,414
    Likes Received:
    55
    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
     
Thread Status:
Not open for further replies.