Memo
echo MySQL起動スクリプト
net start mysql
mysql -u root -p
net stop mysql
システムエラー5
管理者権限が必要。windowsボタン
cmdを入力。
Ctrl+Shift+Enter。
もしくはコマンドプロンプトアイコンを右クリック、管理者として実行。
SQLコマンド
データベースの作成
status
show databases;
use databaseName;
show tables;
describe tableName;
create database databaseName;
desc tableName;
テーブルの作成
create table arsenal_player(
player_cd int(3),
player_name varchar(10),
primary key (player_cd)
);
ユーザーの作成と権限の付与
select user from mysql.user;
grant all on databaseName.* to userName@localhost identified by 'password';
show grants for userName;
レコードの追加
insert into tableName (player_cd,player_name) values(1,'Almunia');
insert into tableName values(2,'Diaby');
insert into tableName values
(4,'Fabregas'),(5,'Vermaelen'),(6,'Koscielny');
select * from tableNmae;
delete from tableName;
文字コード
show variables like 'char%';
CSVファイルの取り込み。「C:\mysql\data\data.csv」
データ型
データ型 |
説明 |
ストレージ |
int |
整数データを使用する実数データ型 |
4byte |
char |
Unicodeではない固定長の文字型データ |
n |
varchar |
Unicodeではない可変長の文字型データ |
n |
nchar |
n文字で構成される固定長Unicode文字データ |
n×2 |
nvarchar |
n文字で構成される可変長Unicode文字データ |
n×2 |