Help us understand the problem. What is going on with this article?

MYSQLメモ

More than 1 year has passed since last update.

MYSQL(SQL)を書く上でよく使うコード類のメモです

※随時追加予定
コマンドプロンプトからの立ち上げ
mysql -u root -p

データベース一覧を見る
SHOW DATABASES;

現在のデータベースのテーブル一覧を見る
SHOW TABLES;

データベース選択
USE データベース名;

現在のデータベース確認
SELECT DATABASE();

データベース削除
DROP DATABASE 削除したいデータベース名;

ターブルの中身確認
SELECT *  FROM テーブル名;

データベースとテーブルを選択して中身確認
SELECT * FROM データベース名.テーブル名;

ユーザー作成
CREATE USER ユーザー名

ユーザー削除
DROP USER ユーザー名

mysqlのユーザー確認
SELECT USER, HOST FROM mysql.user;

↓実行結果
image.png

mysqlのユーザー削除(user名、host名は上記の画像と一致)
DROP USER user名@host名;

aaaarkw
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした