LoginSignup
1
1

More than 5 years have passed since last update.

MySQL入門

Posted at

用語

  • データベース
    • スプレッドシート的な
  • テーブル
  • フィールド
  • レコード

コマンド

起動

mysql -u root

パスワード設定

set password for root@localhost=password('hogehoge');

dbを作る

creata database ghogehoge

dbを削除

drop database hogehoge

特定のdbを使う

use db;

作業用ユーザを作成してみる

grant all on hoge_db.* to dbuser@localhost identified by 'hogepass';

テーブルを作成

create table users (
 id int,
 name varchar(255),
 email varchar(255),
 password char(32)
);

テーブルを削除

drop table users;

扱えるデータ

数値
- int
- double

文字列
- char(固定長)
- varchar()
- text(どれだけ長くなるかわからない場合)

日付
- date
- datetime

それ以外
- enumなど

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1