MySQLの基礎
・ログイン
mysql -uroot -p
→パスワード入力を求められる。
・データベース参照
SHOW DATABASES;
・データベース作成
CREATE DATABASE データベース名;
・ユーザー作成
CREATE USER user;
CREATE USER user IDENTIFIED BY 'password';
・権限譲渡
GRANT ALL ON `database`.* TO `user`@`host_name`;
※ユーザ指定の書式例
user_name@host_name
・権限の確認
show grants for `user`@`host_name`;
・文字コードの確認
show variables like 'char%';]
・データベースの使用
USE `database`
・現在のデータベースの表示
SELECT `database`
・ユーザーのリスト表示
select Host, User from mysql.user;
・ユーザーの削除
drop user 'user@localhost';