If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to import/export an existing MySQL database using neatbeans?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-07-10, 15:57
nadeenahmed nadeenahmed is offline
Registered User
 
Join Date: Mar 2010
Posts: 6
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.
Reply With Quote
  #2 (permalink)  
Old 03-07-10, 16:02
rokudan rokudan is offline
Registered User
 
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?
Reply With Quote
  #3 (permalink)  
Old 03-07-10, 16:06
nadeenahmed nadeenahmed is offline
Registered User
 
Join Date: Mar 2010
Posts: 6
Can I do that in netbeans?
Reply With Quote
  #4 (permalink)  
Old 03-07-10, 16:11
rokudan rokudan is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 03-07-10, 16:41
nadeenahmed nadeenahmed is offline
Registered User
 
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
How to import/export an existing MySQL database using neatbeans?-sql.jpg  
Reply With Quote
  #6 (permalink)  
Old 03-07-10, 16:50
rokudan rokudan is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 03-07-10, 17:13
saly saly is offline
Registered User
 
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 ?!
Reply With Quote
  #8 (permalink)  
Old 03-07-10, 17:18
rokudan rokudan is offline
Registered User
 
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.
Reply With Quote
  #9 (permalink)  
Old 03-07-10, 17:23
nadeenahmed nadeenahmed is offline
Registered User
 
Join Date: Mar 2010
Posts: 6
I am still having problems .
Thank you so much for all your help.
Attached Thumbnails
How to import/export an existing MySQL database using neatbeans?-sql_2.jpg  

Last edited by nadeenahmed; 03-07-10 at 17:27.
Reply With Quote
  #10 (permalink)  
Old 03-07-10, 17:23
saly saly is offline
Registered User
 
Join Date: Mar 2010
Posts: 4
how to get the shell access ?

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

thanks for helping
Reply With Quote
  #11 (permalink)  
Old 03-07-10, 17:32
rokudan rokudan is offline
Registered User
 
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.
Reply With Quote
  #12 (permalink)  
Old 03-07-10, 17:46
saly saly is offline
Registered User
 
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!!
Reply With Quote
  #13 (permalink)  
Old 03-07-10, 17:50
saly saly is offline
Registered User
 
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
Reply With Quote
  #14 (permalink)  
Old 03-07-10, 18:16
nadeenahmed nadeenahmed is offline
Registered User
 
Join Date: Mar 2010
Posts: 6
I dont know what the problem is. Nothing seems to work.
Attached Thumbnails
How to import/export an existing MySQL database using neatbeans?-sql2.jpg  
Reply With Quote
  #15 (permalink)  
Old 03-07-10, 18:26
rokudan rokudan is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On