FreeBSD 10.2 RELEASE - MySQL - よく使うコマンド

クラウディア 
 これは わたしが よく使うコマンドです。お間違えなきよう。
1. データベースの一覧を調べる
2. 文字コードを調べる
3. データベースの作成

1. データベースの一覧を調べる


SHOW DATABASES;

> mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2778
Server version: 5.6.26 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| myhome             |
| mysql              |
| performance_schema |
| test               |
| wordpress          |
| xoops              |
+--------------------+
7 rows in set (0.00 sec)

mysql> quit
Bye

2. 文字コードを調べる

 「インストールと設定」で文字コードの変更方法について記述していましたが、文字コードを確認する方法について記述していませんでした。  mySQL が動作している状態で mysql

> mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.26 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
 mysql のプロンプトが表示されたところで status

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.6.26, for FreeBSD10.2 (i386) using  EditLine wrapper

Connection id:          3
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          more
Using outfile:          ''
Using delimiter:        ;
Server version:         5.6.26 Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
UNIX socket:            /tmp/mysql.sock
Uptime:                 52 min 13 sec

Threads: 1  Questions: 12  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.003
--------------
 とまあこんな感じです。

3. データベースの作成

 以下、すべて mySQL のクライアントインタフェース上ですが・・・。  データベースの作成

mysql> CREATE DATABASE データベース名;
 ユーザにデータベースへの権限を与える

mysql> GRANT ALL ON データベース名.テーブル名 TO ユーザ名;
ハイスピードプラン