Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Mar 2010
    Posts
    6

    Unanswered: How to import/export an existing MySQL database using neatbeans?

    I have Connected to a MySQL Database using a netbeans editor. Now, I want to use that same database I created earlier on another pc. Can anyone help and tell me how that is done, please?

    Thank you.
    Last edited by nadeenahmed; 03-07-10 at 16:55.

  2. #2
    Join Date
    Mar 2010
    Posts
    16
    Can you not do a mysqldump on the pc you created the database on, and then do an import via mysql < dump.sql to the new database server?

  3. #3
    Join Date
    Mar 2010
    Posts
    6
    Can I do that in netbeans?

  4. #4
    Join Date
    Mar 2010
    Posts
    16
    Not that I know of, it is something you do via command line on the MySQL server itself. Do you not have access to the server?


    If you can only connect via a GUI over port 3306, perhaps you could use MySQL WorkBench to reverse engineer the database from the original server, then forward engineer it to the new server.

  5. #5
    Join Date
    Mar 2010
    Posts
    6
    I get an error as seen in the attachment. Can you help you with the problem, please?
    Attached Thumbnails Attached Thumbnails sql.jpg  

  6. #6
    Join Date
    Mar 2010
    Posts
    16
    Since oyu are trying to run a system command from the mysql client, you need to prefix the command with \!.

    So

    \! mysqldump dbname > dump.sql

    If your defalut credentials do not have permission, then add -u USERNAME - p.

    Where USERNAME is a user that has proper permissions. The -p will prompt for the password once you submit the command.

    Example:

    \! mysqldump -u root -p testdb > dump.sql

  7. #7
    Join Date
    Mar 2010
    Posts
    4
    please can U tell me how to go to (shell) ?

    i'm like nadeenahmed, i have the same problem!!

    i want to run the command from shell, not from my sql .

    how can do this ?!

  8. #8
    Join Date
    Mar 2010
    Posts
    16
    You need to have shell access to whatever server MySQL is running on. SSH or Console typically if it is linux, and a simple DOS box if you are on Windows.

  9. #9
    Join Date
    Mar 2010
    Posts
    6
    I am still having problems .
    Thank you so much for all your help.
    Attached Thumbnails Attached Thumbnails sql_2.jpg  
    Last edited by nadeenahmed; 03-07-10 at 17:27.

  10. #10
    Join Date
    Mar 2010
    Posts
    4
    how to get the shell access ?

    i'm running my sql through DOS (windows) ...

    thanks for helping

  11. #11
    Join Date
    Mar 2010
    Posts
    16
    nadeenahmed, can you just try opening a command prompt, Windows DOS box, and run the mysqldump statement straight from the command line, without starting the mysql command line client.

    saly, as long as the mysql folder is in your path statement, all you should have to do is type mysql from within the command session.

  12. #12
    Join Date
    Mar 2010
    Posts
    4
    i have followed the MYSQL manual and it uses the dump command for backup,,

    but the problem is that they use it from (shell) not (mysql)..




    BTW,, this is my first time to deal with MySql ,, and i get so lost!!

  13. #13
    Join Date
    Mar 2010
    Posts
    4
    6.4.1. Dumping Data in SQL Format with mysqldump
    This section describes how to use mysqldump to create SQL-format dump files. For information about reloading such dump files, see Section 6.4.2, “Reloading SQL-Format Backups”.

    By default, mysqldump writes information as SQL statements to the standard output. You can save the output in a file:

    shell> mysqldump [arguments] > file_name

    To dump all databases, invoke mysqldump with the --all-databases option:

    shell> mysqldump --all-databases > dump.sql

    To dump only specific databases, name them on the command line and use the --databases option:

    shell> mysqldump --databases db1 db2 db3 > dump.sql

    << i've copy it from the manual

  14. #14
    Join Date
    Mar 2010
    Posts
    6
    I dont know what the problem is. Nothing seems to work.
    Attached Thumbnails Attached Thumbnails sql2.jpg  

  15. #15
    Join Date
    Mar 2010
    Posts
    16
    nad, You probably dont have mysql in your environment variables path. Switch to the directory you installed mysql into, and run the commands from within there.

Posting Permissions

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