SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2000
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am trying to figure out the commands to delete and create a database via telnet. I am getting an error table **** already exists which means I can either drop all the tables or drop database and start from scratch with my backup file.

    Can somebody give me the goods?

    Thanks
    "Over 2200 Free Webmaster Resources and Tools"
    Search through our continually updated directory of free webmaster resources.
    WebmasterLane.com

  2. #2
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    search mysql.com's manual for create it should give you what you need ... however, certain servers only allow you one preset database. you can normally setup as many tables as you want though, so you might just wanna setup a new table with a different name.

    still though, best bet is mysql.com's manual, and search for create and delete (and also maybe new).

    Good Luck

    ... what's the world coming to?

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2000
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay can anybody help...I tried the mysql.com but there are no telnet commands.

    What I am trying to do is restore vBulletin:

    I am receiving this error via telnet.

    table '****' already exists

    I am using the following command:
    mysql -u**** -p***** survivor < survivor.sql

    Is there a command that I can use to tell it to overwrite my existing tables, because I can't figure out any other way.

    Can somebody please help as my current hosting ends in a day.
    "Over 2200 Free Webmaster Resources and Tools"
    Search through our continually updated directory of free webmaster resources.
    WebmasterLane.com

  4. #4
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're using a host, I don't think you have the permission to drop or add a database, you can only do it with the tables w/in your DB.

    To drop a table if it's existed:
    DROP TABLE IF EXISTS tableName;
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2000
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get a no database selected error.
    "Over 2200 Free Webmaster Resources and Tools"
    Search through our continually updated directory of free webmaster resources.
    WebmasterLane.com

  6. #6
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Son Nguyen is exactly correct. Caution is the watchword wheninto the telnet side.

    I have a service from another company that is not my isp so I telnet into them to do what I need. I do not have the authority to create or remove a db.

    What I do work with is creation and removal of tables. Here is how:

    telnet into the host.
    host>

    then i enter: mysql -u myid -p <enter>

    password:

    and I enter the password for my account <enter>

    mysql>

    at this point i am into the server. this is where i log into my database (many other dbs are also on the server but only one is mine. so i enter the name of the db.

    USE mydb...........mydb is the name assigned to the database.

    this is the only command in mysql that does not require the ; to end the command! my next command is usually

    SHOW tables;

    and out will pop a listing of tables. then I want to look at the items and definition of fields. So i

    DESCRIBE tablename;

    This may be what you want. If not, I will be more than happy to try to answer questions. Since I do not have mysql on a server under my control, can't help there. But someone here will be able to.

    peace

  7. #7
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by webmasterlane.com
    Is there a command that I can use to tell it to overwrite my existing tables, because I can't figure out any other way.
    I would do this:
    1) Login via telnet, then enter MySQL:
    mysql -uUSERNAME -pPASSWORD
    2) Type the following:
    DROP database databasename
    (from your post it looks like your database name is survivor...substitute this for databasename)
    3) Type the following:
    CREATE database newdatabasename
    (same thing...substitute whatever you want for newdatabasename)
    4) Type the following:
    exit
    5) Enter MySQL as follows:
    mysql -uUSERNAME -pPASSWORD newdatabasename < /full/path/to/sqlfilename.sql
    (substitute the new database you created in step 3 for newdatabasename)
    6) It may take up to 30 seconds. It should return you to the telnet prompt when done.

    This should work, unless you don't have permissions to drop and create databases. But some hosts allow this, especially if you are allowed more than one database. If you can't do it this way, and your host gives you a control panel, look in the control panel for a MySQL section and see if you can create/delete databases through there.
    Last edited by tubedogg; Mar 20, 2001 at 05:41.
    Kevin

  8. #8
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by webmasterlane.com
    I get a no database selected error.
    To select a DB when you're already logged in MySQL:
    use <DBName>;
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  9. #9
    SitePoint Zealot
    Join Date
    Aug 2000
    Posts
    184
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    THANK YOU!!!!!!!!

    Thank you to everyone this is EXACTLY what I needed. It turns out I do have permissions to drop and add databases, but was using the wrong syntex until you guys helped me out. I got my message board up and running.

    Once you know what to do it is soooooo..... easy to move a vBulletin message board. Just move your files to the new host, backup your database and re-upload.

    Thanks again....much appreciated to everyone that helped.
    "Over 2200 Free Webmaster Resources and Tools"
    Search through our continually updated directory of free webmaster resources.
    WebmasterLane.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •