I have access on two different Windows systems. There is one MySQL database on one system which I want to copy to another system. Please note that I haven't username and password for DB access on the first system where this database available. I have already searched this this issue and did not found this answer relevant for me.

  • I haven't username and password ?
    – Joraid
    Feb 18, 2014 at 5:48
  • @Joraid: Read as don't have.
    – Ravinder
    Feb 18, 2014 at 5:49
  • stackoverflow.com/questions/5439596/…
    – Vinod VT
    Feb 18, 2014 at 5:49
  • yes, I haven't username and password of the database system.
    – ursitesion
    Feb 18, 2014 at 5:49
  • why you are not going to export/import?
    – Ganesh Patil
    Feb 18, 2014 at 5:49

2 Answers 2


i can help u with

Copy all files from first machine resides in C:\wamp\bin\mysql\mysql5.6.12\data

and copy it to in your new maching in same path.

Hope it helps

  • I tried by copied the folder from one system to another. But, it didn't work. I got only list of tables. I can run show tables from dbname. It list the tables. But, when I run select * from dbname.table1 - it shows Table 'dbname.tablename' doesn't exist
    – ursitesion
    Feb 18, 2014 at 6:00
  • for me it worked ! i have tried this many times , I guess there is some problem !! i can suggest you that try to copy only one table first, i guess mysql tables duplicated or conflicted. :(
    – Janak Prajapati
    Feb 18, 2014 at 6:04

try this data Migrator

 * Data Migrator Merger is for merging the data/records of two database of completely same or similar schema.
 * @author Nitesh Apte

class DataMigratorMreger {

    private $conn;
    private $sourceDB;
    private $destinationDB;

    public function __construct() {
        $this->conn = mysql_connect("localhost", "root", "");

    public function mergeData($oldSchema, $newSchema, $reverse = FALSE) {
        mysql_query("SET FOREIGN_KEY_CHECKS = 0");

        if($reverse) {
            $this->destinationDB = $oldSchema;
            $this->sourceDB = $newSchema;
        } else {
            $this->destinationDB = $newSchema;
            $this->sourceDB = $oldSchema;

        mysql_query("use ".$oldSchema);

        $tables = $this->getAssoc("show tables");

        for($i=0;$i<count($tables);$i++) {

            /* Disable this in case you want to merge the data */
            $trun = "TRUNCATE $this->destinationDB.".$tables[$i]['Tables_in_'.$this->sourceDB];

            $values = $this->getAssoc("describe ".$tables[$i]['Tables_in_'.$oldSchema]);

            // put $j=1 in case of merging. Generally, first column is auto incremented id
            for($j=0;$j<count($values);$j++) {
                $val[$i][] =  $values[$j]['Field'];

            $field = implode(',', $val[$i]);

            $sql = "INSERT INTO $this->destinationDB.".$tables[$i]['Tables_in_'.$oldSchema]." ($field) SELECT ".$field." FROM $this->sourceDB.".$tables[$i]['Tables_in_'.$oldSchema];


        mysql_query("SET FOREIGN_KEY_CHECKS = 1");

    public function getAssoc($queryString) {

        $rs = mysql_query($queryString, $this->conn);

        while($rw = @mysql_fetch_array($rs, MYSQL_ASSOC)){
            $values[] = $rw;
        return $values;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.