Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    handling ; at the end of exported .db file

    i have exported a large database - that big i cant import it in one piece, so i have to import it via mysql_query and first explode the whole string.

    but, i have problems with ';' at the end of each clause. how can i tell mysql to eat them?

    INSERT INTO mytable a,b VALUES ('c','d');
    __________________________________^this.

    thanks!

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    why can't you import it in one piece? if mysql could export it, it should be able to import it...
    are you using some gui front-end, or the mysql command line?

    using mysql_query doesn't seem particularly sensible, but http://php.net/substr might help...

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    are you not able to upload the file to your server?
    if you can then just run:
    Code:
    source /pathtothefile/filename
    and then the file will run the inserts, table builds etc.

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i cannot upload it and execute in phpmyadmin because it is too big... execution time too large...
    well, this with 'source' could be interesting, i have to check around

  • #5
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    huh... and how can i use this source thing?

  • #6
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    ftp the file to your server and then within the SQL query area of phpmyadmin run the command I showed you.

  • #7
    Regular Coder
    Join Date
    Aug 2004
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    //like that?
    mysql_query('SOURCE "myfile.db"');

  • #8
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    You may be able to run it like that, I'm not sure. What I would do is just use the tab in phpmyadmin that is labeled SQL query.
    within that only type:
    Code:
    SOURCE myfile.db
    you will need the entire path to the file UNLESS you ftp'd the file into your mysql/data directory.


  •  

    Posting Permissions

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