俺の外部記憶
CentOS_MySQL_SQL
最終更新:
Bot(ページ名リンク)
-
view
UPDATE 2010年08月28日 (土) 19時44分02秒;
データベース作成
mysqladmin -u mysql -p create データベース名
または、mysql起動後、
create database データベース名;
パスワード変更
mysql -u mysql
で、ログイン後
で、ログイン後
set password for mysql@localhost=password('パスワード');
ユーザ情報
ユーザ情報参照
select user, host, password from mysql.user;
ユーザを削除
delete from mysql.user where user="ユーザ名";
テーブル作成のサンプル
create table testtable( id int2, name text, name blob); int2:数値(数字用) text:テキスト形式のデータ(文字列用) blob:バイナリ形式のデータ(画像などバイナリ用)
データベースをEUCで作った場合、SJISの文字列をテーブルにinsertするには、
フィールド(カラム)をバイナリ形式で作る。
フィールド(カラム)をバイナリ形式で作る。
テーブルにデータを挿入
insert into testtable values('1','test1'); insert into testtable values('2','test2'); insert into testtable values('3','test3'); insert into testtable values('4','テスト4');
テーブルを参照
select * from testtable;
テーブルのデータを削除
delete from testtable where id=4;