Skip to main content

The easiest solution would be to write a small script that reads that file and executes some queries to import these data sets.

If you want to use PHP (just one example, more information here) it would be something like:

    <?php
    
    $db = new PDO($connectStr, $username, $password);
    $q = $db->prepare("INSERT INTO table (...) VALUES (...)");
    
    $file = file_get_contents(...);
    $lines = explode("\n", $file);
    
    foreach ($lines as $line) {
        $data = explode(";", $line);
        // manipulate password here, for PHP, use password_hash instead of md5
        $q->execute([$data]);
    }
    ?>

Another promising solution could be LOAD DATA INFILE. You should have a look at http://dev.mysql.com/doc/refman/5.1/en/load-data.html for more information.

The easiest solution would be to write a small script that reads that file and executes some queries to import these data sets.

If you want to use PHP (just one example, more information here) it would be something like:

<?php

$db = new PDO($connectStr, $username, $password);
$q = $db->prepare("INSERT INTO table (...) VALUES (...)");

$file = file_get_contents(...);
$lines = explode("\n", $file);

foreach ($lines as $line) {
    $data = explode(";", $line);
    // manipulate password here, for PHP, use password_hash instead of md5
    $q->execute([$data]);
}

Another promising solution could be LOAD DATA INFILE. You should have a look at http://dev.mysql.com/doc/refman/5.1/en/load-data.html for more information.

The easiest solution would be to write a small script that reads that file and executes some queries to import these data sets.

If you want to use PHP (just one example, more information here) it would be something like:

    <?php
    
    $db = new PDO($connectStr, $username, $password);
    $q = $db->prepare("INSERT INTO table (...) VALUES (...)");
    
    $file = file_get_contents(...);
    $lines = explode("\n", $file);
    
    foreach ($lines as $line) {
        $data = explode(";", $line);
        // manipulate password here, for PHP, use password_hash instead of md5
        $q->execute([$data]);
    }
    ?>

Another promising solution could be LOAD DATA INFILE. You should have a look at http://dev.mysql.com/doc/refman/5.1/en/load-data.html for more information.

Source Link
kelunik
  • 116
  • 2

The easiest solution would be to write a small script that reads that file and executes some queries to import these data sets.

If you want to use PHP (just one example, more information here) it would be something like:

<?php

$db = new PDO($connectStr, $username, $password);
$q = $db->prepare("INSERT INTO table (...) VALUES (...)");

$file = file_get_contents(...);
$lines = explode("\n", $file);

foreach ($lines as $line) {
    $data = explode(";", $line);
    // manipulate password here, for PHP, use password_hash instead of md5
    $q->execute([$data]);
}

Another promising solution could be LOAD DATA INFILE. You should have a look at http://dev.mysql.com/doc/refman/5.1/en/load-data.html for more information.