Solved

Copy and rename a MySQL database and its information

Posted on 2011-03-24
7
541 Views
Last Modified: 2012-05-11
Im using MySQL Server 4.1 and MySQL Administrator and I want to copy a database and its information and rename it so I can use it for another site. Can anyone tell me how to do this?
0
Comment
Question by:overcolor
  • 3
  • 3
7 Comments
 
LVL 9

Expert Comment

by:fcontrepois
ID: 35213118
Use mysqldump to extract the data then create the new db and restore the data.
0
 
LVL 3

Accepted Solution

by:
dagaz_de earned 500 total points
ID: 35214223
U can use a .bat File if you eter something like this.
Please modify the Mapped D:\ and replace the placeholders (YOUR_...) to your needs.

C:\YOUR_FOLDER_WHERE_MYSQL_IS\bin\mysqldump -u YOUR_USER --password=YOUR_PASSWORD YOUR_DB YOUR_TABLE  | mysql -u YOUR_USER --password=YOUR_PASSWORD YOUR_DB YOUR_NEW_TABLE_NAME

you can use this command also in your mysqladmin or the console window
0
 

Author Comment

by:overcolor
ID: 35218940
@dagaz_de
what if the directory where the mysqldump is has spaces

C:\Program Files (x86)\MySQL\MySQL Server 4.1\bin\mysqldump
??
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 9

Expert Comment

by:fcontrepois
ID: 35219758
Use "
0
 

Author Comment

by:overcolor
ID: 35220108
fcontrepois

Im sorry I don't understand what you are saying?
0
 
LVL 9

Expert Comment

by:fcontrepois
ID: 35220898
Use "c:\program files\...\mysqldump.exe" --all-databases

For example
0
 

Author Comment

by:overcolor
ID: 35221532
This is what Im using, is this correct?

"C:\Program Files (x86)\MySQL\MySQL Server 4.1\bin\mysqldump.exe" -u root --password=password dataold  | mysql -u root --password=password datanew
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Trigger usage 2 75
insert into database through form with dynamic fields. 2 37
Present Absent from working date rage 11 36
Managing DSNs in CF 11 5 14
Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question