SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    import/export mysql database

    hey guys..

    i just got a new laptop and i am in the process of transferring all my files..
    on my previous desktop, i had installed mysql and php and had a mysql database up and running

    i want to export that whole database into a .sql file, email it to myself and then import the .sql file on my laptop

    this is all happening on my local testing apache server..is this possible? how should i go about doing it?

    tahnks in advance

  2. #2
    Non-Member melancholic's Avatar
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You might want to have a look at tthe free MySQL GUI tools.
    http://dev.mysql.com/downloads/

    Other than that, I use phpmyadmin frequently. you can export/import from command line, but, that's another story. This is the easiest way

    regards,

  3. #3
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,198
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    The simplest way of doing it is to use the command line.

    First on your server:
    mysql -u username -p databasename > filename_with_path_and_extension

    Then on the laptop:
    mysql -u username -p

    After logging into mysql command promp write this:
    create databasename
    then
    databasename < filename_with_path_and_extension

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the .sql file is saved on my desktop
    can you please elaborate on "filename_with_path_and_extension" knowing this location?

  5. #5
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,198
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    That depends on the operating system you are running, what the letter of the harddrive its installed on is etc.

    If you are not sure, just copy the file directly under one of the harddrives and access it from there.

  6. #6
    Non-Member melancholic's Avatar
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first instance of "filename_with_path_and_extension" in TRD's example should be replaced with the path where you would like the file exported.

    In the second instance of TRD's example, it's where you have the file that you want imported.

    regards,

  7. #7
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i have successfully imported my database to my laptop. i have also downloaded all my site files through ftp...but i have one new problem

    i'm using apache and my site output is perfect on localhost...the problem is related to mysql

    on localhost, i have created a login page (login.php) which is supposed to redirect me to account.php once successfully logged in -> i put my username and pass (which is stored in mysql) -> i'm NOT able to log in -> usually an error is shown for incorrect information, but in this case, the page just reloads...the url shows /account.php...so it processed the request but didn't proceed.

    the site checks if someone is logged in through sessions on each page, so i thought sessions might be the problem...i went to php.ini and noticed that sessions were working fine

    then i thought, maybe my php code isn't connecting with the mysql...i made a testing page to capture some fields from the database and it worked!

    so i'm really lost here...all the files i downloaded through ftp work fine online...just causing problems on localhost

    helpp (thanks for resolving the import/export problem, but this is worse)

  8. #8
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,198
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    Since you say that your able to access fields from the database, I do not believe this is a "mysql" issue. It sounds like there is some differences in the php or apache settings on your laptop compared to the server.

  9. #9
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any idea what those settings might be?
    im using:
    mysql 5.0
    php 5.2
    apache 2.2
    Last edited by popendot; Aug 11, 2006 at 11:14.

  10. #10
    SitePoint Zealot
    Join Date
    Mar 2006
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i just noticed something...my.cnf (the config file i created when i dled mysql is a "speeddial" file..i cant even open it..

    i think thats the problem. i checked on desktop and the my.cnf file there is a proper .cnf file..

    how should i resolve this?


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
  •