MySQL/使用しているデータベースの確認方法
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* 使用しているデータベースの確認方法 [#i16c8f40]
MySQLで現在使用してるデータベースを調べる方法を以下に記し...
#contents
#htmlinsertpcsp(db-top.html,db-sp.html)
* 関連資料 [#f81462d1]
-[[MySQLでデータベース一覧を表示する方法>MySQL/データベー...
* 使用しているデータベースを調べる [#u9019744]
使用してるデータベースを調べるには以下のコマンドを発行し...
SELECT database();
以下、SELECT database();を使用した実行結果を記します。
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. ...
Oracle is a registered trademark of Oracle Corporation a...
affiliates. Other names may be trademarks of their respe...
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the cu...
mysql> SELECT database();
+------------+
| database() |
+------------+
| NULL |
+------------+
1 row in set (0.00 sec)
MySQL接続直後は使用しているデータベースがNULL(なし)になっ...
データーベース一覧を表示します。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| db1 |
| db2 |
| db3 |
| mysql |
+--------------------+
5 rows in set (0.00 sec)
USEコマンドでdb1データベースに接続します。
mysql> use db1;
Database changed
SELECT database();コマンドで接続してるデータベースを表示...
mysql> SELECT database();
+------------+
| database() |
+------------+
| db1 |
+------------+
1 row in set (0.00 sec)
mysql>
#htmlinsertpcsp(db-btm.html,db-sp.html)
終了行:
#navi(../)
* 使用しているデータベースの確認方法 [#i16c8f40]
MySQLで現在使用してるデータベースを調べる方法を以下に記し...
#contents
#htmlinsertpcsp(db-top.html,db-sp.html)
* 関連資料 [#f81462d1]
-[[MySQLでデータベース一覧を表示する方法>MySQL/データベー...
* 使用しているデータベースを調べる [#u9019744]
使用してるデータベースを調べるには以下のコマンドを発行し...
SELECT database();
以下、SELECT database();を使用した実行結果を記します。
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. ...
Oracle is a registered trademark of Oracle Corporation a...
affiliates. Other names may be trademarks of their respe...
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the cu...
mysql> SELECT database();
+------------+
| database() |
+------------+
| NULL |
+------------+
1 row in set (0.00 sec)
MySQL接続直後は使用しているデータベースがNULL(なし)になっ...
データーベース一覧を表示します。
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| db1 |
| db2 |
| db3 |
| mysql |
+--------------------+
5 rows in set (0.00 sec)
USEコマンドでdb1データベースに接続します。
mysql> use db1;
Database changed
SELECT database();コマンドで接続してるデータベースを表示...
mysql> SELECT database();
+------------+
| database() |
+------------+
| db1 |
+------------+
1 row in set (0.00 sec)
mysql>
#htmlinsertpcsp(db-btm.html,db-sp.html)
ページ名: