MySQLを使ったときのコマンドのメモ

ユーザの追加

mysql> GRANT ALL PRIVILEGES ON *.* TO hoge@localhost IDENTIFIED BY 'hoge_pass';

テーブルの作成

mysql>create table [tablename](key1 char(255), key2 int);

データ削除・インクリメントカウンタクリア

mysql>TRUNCATE TABLE

参照リンク
http://dev.mysql.com/doc/refman/4.1/ja/truncate.html

インクリメンタル自動インデックス

alter table table_name add index ind1(id);                    # インデックスを付加
alter table table_name modify id int auto_increment;      # インデックスに自動属性追加

結果の表示数に制限を付ける

select * from table_name limit 0,1;         # この場合オフセット0で1個だけを表示