#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    2
    Rep Power
    0
    I created some tables in the mysql db and now I want to move them to their own db. how can I move the selected tables (ie not the admin tables) to the new db I created?
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    Not sure on this, but you might be able to just copy the files to the new location, drag and drop or copy() or whatever...

    If not, you can dump the files, then import them back into the correct database using mysqldump

    ---JH
  4. #3
  5. No Profile Picture
    Carpe Diem
    Guest
    Devshed Newbie (0 - 499 posts)
    Use mysqldump in the following format :-

    mysqldump -uuser -ppassword database table >table.sql

    then to import
    mysql -uuser -ppass database <table.sql

    Don't try and copy the files, 9/10 times it will cause you problems



    ------------------

    Regards
    Darren
    --
    http://www.php4hosting.com/ $
    http://www.php4hosting.co.uk/ £
    PHP/MySQL Enabled Hosting/Dedicated Servers
  6. #4
  7. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    Okay....you can ignore what I said..
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    2
    Rep Power
    0
    Thanks! I finally got around to trying this and it worked great.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Carpe Diem:
    Use mysqldump in the following format :-

    mysqldump -uuser -ppassword database table >table.sql

    then to import
    mysql -uuser -ppass database <table.sql

    Don't try and copy the files, 9/10 times it will cause you problems


    [/quote]

  10. #6
  11. No Profile Picture
    raydenx
    Guest
    Devshed Newbie (0 - 499 posts)
    i alway get an error message whenver i use mysqldump on my pc and on telnet......

    ERROR 1064: parse error near 'mysqldump -u myusername -p mypassword dbname tablename > db.sql' at line 1

    anybody knows why? im going crazy cos of this!
  12. #7
  13. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    Mysqldump is a program that you run from the command line, NOT from within mysql.

    C:mysqlbinmysqldump -uuser -p database > database.sql

    See?

    ---John Holmes...

    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions...
    *
    * PHP Manual. www.php.net/manual
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter
    *************************************************************
  14. #8
  15. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    raydenx--

    Also, you need to NOT use a space between -p and your password.

    Wrong:
    mysqldump -u myusername -p mypassword dbname tablename > db.sql

    Right:

    mysqldump -u myusername -pmypassword dbname tablename > db.sql

    or:

    mysqldump -u myusername -p dbname tablename > db.sql (this way, you get a terminal prompt asking you for the password before processing the request... useful if you don't want others seeing your password over your shoulder)


Similar Threads

  1. How do I find out what tables are on the database?
    By Swell in forum Oracle Development
    Replies: 7
    Last Post: February 18th, 2004, 08:18 AM
  2. How to know which tables are on a database?
    By c.caraccioli in forum PostgreSQL Help
    Replies: 5
    Last Post: January 22nd, 2004, 01:06 PM
  3. Count all tables in a database
    By Joput in forum PHP Development
    Replies: 1
    Last Post: January 14th, 2004, 08:31 AM
  4. creating database & tables using ASP
    By pdxlooie in forum ASP Programming
    Replies: 2
    Last Post: December 26th, 2003, 05:27 PM
  5. moving database
    By salmanucit in forum MySQL Help
    Replies: 2
    Last Post: December 26th, 2003, 12:21 PM

IMN logo majestic logo threadwatch logo seochat tools logo