サーバ移転時など、データ移行を行う必要がある。データ量が多すぎてphpMyAdminがタイムアウトになり、ブラウザからインポートできない場合がある。
そういった場合、コマンドラインからインポートすることで実現する。
①ログイン
[Linux]
# mysql -u root -p
Enter password:
[Mac]
# /Applications/MAMP/Library/bin/mysql -u root -p
Enter password:
②データベース作成
mysql> create database {database_name};
③DB指定
mysql> use dbname
Database changed
④データファイルを指定してインポート
mysql> source /Users/{myname}/Downloads/data.sql
ちなみに
⑤ユーザ作成
mysql> grant all privileges on {database_name}.* to {user_name}@localhost identified by '{password}';


Comments
1 comments postedThe information is very interesting.
Submitted by Anonymous user on 2012, January 14 - 08:48.The information is very interesting. I like the post. Thank you, this advice will come in handy. It made me understand something, and it is that I never knew before.
male waxing London
Post new comment