SitePoint Sponsor

User Tag List

Results 1 to 20 of 20

Thread: Export

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Export

    Hi,
    Is it OK by this? I expect that the export file will be backup.sql
    mysqldump --tables -u db_user_name -p db_name >> backup.sql
    Many Thanks & Best Regards,
    HuaMin Chen

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Furthermore, is there any example for that we insert one record with one image file (from the local disk), to the DB table?
    Many Thanks & Best Regards,
    HuaMin Chen

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any advice?
    Many Thanks & Best Regards,
    HuaMin Chen

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    for your first question ("is it OK by this"), you can get your answer by testing what you have to see if it works

    for your second question ("insert one record with one image file"), you need to provide more information -- start with giving us the results of the SHOW CREATE TABLE statement for the table
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks
    I've tried this and have got
    C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqldump -u user_name -p the_password -database
    s DBname > backup.sql
    mysqldump: unknown option '-b'

    Next what should be the right syntax of 'SHOW CREATE TABLE statement '?
    Many Thanks & Best Regards,
    HuaMin Chen

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by HuaMin View Post
    Next what should be the right syntax of 'SHOW CREATE TABLE statement '?
    Code:
    SHOW CREATE TABLE tablename
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. How about this problem?

    I'm to create one table. Why do i need to run 'show create table'?
    Many Thanks & Best Regards,
    HuaMin Chen

  8. #8
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by HuaMin View Post
    Why do i need to run 'show create table'?
    so that i can help you with your problem "insert one record with one image file"
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  9. #9
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    many thanks!

    mysql> show create table ae_gallery;
    +------------+------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    -----------------------------------------+
    | Table | Create Table



    |
    +------------+------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    -----------------------------------------+
    | ae_gallery | CREATE TABLE `ae_gallery` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(64) CHARACTER SET utf8 NOT NULL,
    `ext` varchar(8) CHARACTER SET utf8 NOT NULL,
    `image_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TI
    MESTAMP,
    `data` mediumblob NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +------------+------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    -----------------------------------------+
    1 row in set (1.92 sec)
    Many Thanks & Best Regards,
    HuaMin Chen

  10. #10
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    are you ready to try the INSERT?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  11. #11
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes
    Many Thanks & Best Regards,
    HuaMin Chen

  12. #12
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you provide more details like to use any disk files for the insert, to me?
    Many Thanks & Best Regards,
    HuaMin Chen

  13. #13
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you help?
    Many Thanks & Best Regards,
    HuaMin Chen

  14. #14
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    insert one image

    Hi,
    How about the way to insert one record with one image to the table? I mean to directly run this using mysql prompt.
    Many Thanks & Best Regards,
    HuaMin Chen

  15. #15
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  16. #16
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks. But could you pls show me how I can save one physical image file from the disk to Mysql DB?
    Many Thanks & Best Regards,
    HuaMin Chen

  17. #17
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You cannot do that from the mysql console. You need a programming language to read the image data off disk and insert it into a query.

  18. #18
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. Is it true that the only way is to use PHP and no direct way to put that through Mysql command prompt?
    Many Thanks & Best Regards,
    HuaMin Chen

  19. #19
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The mysql client program has no way to read binary data off disk. The only filesystem function it provides is a command to read SQL queries from a text file.

  20. #20
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    China
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there an example? Many many thanks in advance!
    Many Thanks & Best Regards,
    HuaMin Chen


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
  •