開始
mysql -u ユーザ名 -p
データベースの一覧
show databases;
データベースの選択
use データベース;
テーブルの一覧
show tables;
あるテーブルの全表示
select * from テーブル;
あるテーブルの削除
drop table テーブル;
別ファイルのSQL文を流し込む
mysql --user=ユーザ --database=データベース < ファイル.sql
レコードを更新する
update テーブル set hoge='foo' where 条件;
レコードを削除する
delete from テーブル where 条件;
カラムの一覧を表示する
show columns from テーブル;
カラムを追加する
alter table テーブル add カラム名 型;
カラムを特定カラムの後に追加する
alter table テーブル add カラム名 型 after 特定カラム;
コメントを残す