XAMPPに大きなsqlファイルをインポート

  • このエントリーをはてなブックマークに追加
  • Evernoteに保存Evernoteに保存
  • 0

phpMyAdminで自分のサイトのDBをXAMPP内にインポートしようとしたら、インポートのサイズ制限に引っかかってしまった。対処方法を調べてみると、結構面倒なようである。しかし、簡単で非常にスマートな方法が見つかった。しかし、これぐらいのことで実現するのなら、phpMyAdminがデフォルトで組み込んでいてもよさそうなものだ。ともあれ、この方法は次のサイトで教えてもらった。

phpMyAdminで大きいファイルをインポートする方法

phpMyAdminのconfig.inc.phpの中身は以下の通り。しかし、何処を探しても例示されたコマンドがない。また、同じような情報が書かれたサイトを見ると、phpMyAdminのconfig.inc.phpの行数が500行以上あるかのような記述があった。つまり、phpMyadminのバージョンによって記述されている場所が違うのであろう。

<?php
/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type']     = 'cookie';      // Authentication method (config, http or cookie based)
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
$cfg['Servers'][$i]['recent'] = 'pma_recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma_table_uiprefs';

/*
 * End of servers configuration
 */

?>

更に調べると、自分のphpMyAdminに例示されたコマンドが見つからない場合があるらしい。その場合は、そのコマンドをconfig.inc.phpの最後に貼り付ければ良いと書いてある。早速それを実行してインポート画面に入ってみた(以下の画像がその画面)。

upload

phpMyAdmin Upload

追加する前は「ファイルを選択」しかできなかったが、アップロードディレクトリが追加されて中にあるファイルを選択できるようになっている。そしてインポートは、直ぐに完了することができた。

広告
  • このエントリーをはてなブックマークに追加
  • Evernoteに保存Evernoteに保存
広告

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>