1
2

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 1 year has passed since last update.

mySQLコマンド

Last updated at Posted at 2022-03-18

データベース

ローカル環境でMySQLにログインする

mysql -u [username] -p;

新規データベースの作成

CREATE DATABASE [DatabaseName];

データベースの確認

SHOW DATABASES;

データベースの削除

DROP DATABASE [DatabaseName];

mysqlの状態確認

status; 

テーブルの作成

CREATE TABLE テーブル名 (カラム名1 データ型1, カラム名2 データ型2, ...);

テーブルの中身を全て確認する

SELECT * FROM テーブル名;

USERの追加

CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'user_name'

rootのpassword変更(xxxxにパスワードを入力する)

ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxx';

データベースの接続を切断する。

exit;

参考リンク

データベースオブジェクトの命名規約
MySQL cheatsheet

1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?