0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Mysql入門【授業編】XAMPP ver

Last updated at Posted at 2020-12-08

XAMPPからmysqlにつないで、DB作成、テーブル作成の流れをやる

①XAMPP起動

startボタンを押す

②ターミナルに繋いで、mysql起動

open terminalをクリック。 その後、ターミナルが開いたら ```mysql```

そして、MariaDB [(none)]>が表示されたら、オッケー。

③データベースに繋ぐ

既存のDBに繋ぐ。 ```use データベース名```

④確認系のコマンド

今あるテーブルの一覧を表示 ```show tables;``` +---------------+ | Tables_in_saku | +---------------+ | country | | mhold | | mount | | rhold | | river | +---------------+

こんな感じで出てくる

⑤テーブル作る

``` create table sns ( id serial primary key, name text, title text, message text not null, date date not null, password text ); ```

それからshow tables;で確認するとsnsが追加されているはず!

⑤テーブルの確認(詳細)

テーブルの詳細確認は、 ```describe テーブル名;``` ```desc テーブル名;```でも可能

+----------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------------------+------+-----+---------+----------------+
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| name | text | YES | | NULL | |
| title | text | YES | | NULL | |
| message | text | NO | | NULL | |
| date | date | NO | | NULL | |
| password | text | YES | | NULL | |
+----------+---------------------+------+-----+---------+----------------+
こんな感じ

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?