| |
|
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.
|
 |
|

03-07-10, 15:57
|
|
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.
|

03-07-10, 16:02
|
|
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?
|
|

03-07-10, 16:06
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 6
|
|
|
|
Can I do that in netbeans?
|
|

03-07-10, 16:11
|
|
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.
|
|

03-07-10, 16:41
|
|
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?
|
|

03-07-10, 16:50
|
|
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
|
|

03-07-10, 17:13
|
|
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 ?!
|
|

03-07-10, 17:18
|
|
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.
|
|

03-07-10, 17:23
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 6
|
|
I am still having problems  .
Thank you so much for all your help.
|
Last edited by nadeenahmed; 03-07-10 at 17:27.
|

03-07-10, 17:23
|
|
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
|
|

03-07-10, 17:32
|
|
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.
|
|

03-07-10, 17:46
|
|
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!!
|
|

03-07-10, 17:50
|
|
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
|
|

03-07-10, 18:16
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 6
|
|
I dont know what the problem is. Nothing seems to work  .
|
|

03-07-10, 18:26
|
|
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.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|