MySQLコマンド (DOSプロンプト) 入力編

  • ユーザー名 でログインする。
    > -u ユーザー名 -p
  • データベースを作成する。
    > create database DB名;
  • データベースを確認する。
    > show databases;
  • 普段操作するユーザーを作成する。
    > grant select,insert,delete,update,create,drop,file,alter,index on *.* to ユーザー名 identified by 'パスワード'; > flush privileges;
  • 使用するデータベースを選択する。
    > use DB名;
  • テーブルを作成する。
    > create table テーブル名(
    -> id int(10),
    -> title text,
    -> フィールド名 フィールドのタイプ,
    -> );
  • データの挿入。
    > insert into テーブル名
    -> (id,title,field1,field2,)
    -> VALUES('15','うどん','要素1','要素2');
  • ファイルのインポート
    > load data infile 'C:/CVSデータなど.txt'
    -> into table テーブル名;

カテゴリー: Languages   パーマリンク

コメントをどうぞ

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

*

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