MySQL/データベース、テーブルの管理
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
// 下階層用テンプレート
#topicpath
----
//ここにコンテンツを記述します。
#contents
*** データベースを作成する [#d036fe90]
mysql> CREATE DATABASE データベース名
*** データベースを表示する [#j9c0a1c4]
[root@www ~]# mysqlshow -uroot -p
Enter password:
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| test |
| webdb1 |
+--------------------+
MySQLのプロンプト内で
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
| webdb1 |
+--------------------+
5 rows in set (0.00 sec)
->
とすることもできます。
***データベース情報を表示する [#j291d710]
[root@www ~]# mysqlshow webdb1 -p -uroot
Enter password:
Database: webdb1
+--------+
| Tables |
+--------+
| rss |
+--------+
MySQLのプロンプト内で、
mysql> use webdb1;
Database changed
mysql> show tables;
+------------------+
| Tables_in_webdb1 |
+------------------+
| rss |
+------------------+
1 row in set (0.00 sec)
とすることもできます。
***テーブル情報を表示する [#z88c039d]
[root@www ~]# mysql webdb1 -p -uroot
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 53 to server version: 5.0.15...
Type 'help;' or '\h' for help. Type '\c' to clear the bu...
mysql> describe rss;
+-------+------------------+------+-----+---------------...
| Field | Type | Null | Key | Default ...
+-------+------------------+------+-----+---------------...
| id | int(10) unsigned | NO | PRI | NULL ...
| title | varchar(255) | YES | | ...
| link | text | YES | | NULL ...
| date | datetime | NO | | 0000-00-00 00:...
+-------+------------------+------+-----+---------------...
4 rows in set (0.00 sec)
mysql>
*** テーブル定義を参照する [#qc88633b]
テーブルがどの様なSQL文で作成されたか表示します。
mysql> show create table webdb1.rss;
--------------------------+
| Table | Create Table
--------------------------+
| rss | CREATE TABLE `rss` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(255) default '',
`link` text,
`date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=ujis COMMENT='RSS List' |
+-------+-----------------------------------------------...
1 row in set (0.00 sec)
参考:~
http://www.rfs.jp/sitebuilder/sql/04/07.html#SHOW%20CREAT...
----
この記事は
#vote(おもしろかった[3],そうでもない[4])
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
終了行:
// 下階層用テンプレート
#topicpath
----
//ここにコンテンツを記述します。
#contents
*** データベースを作成する [#d036fe90]
mysql> CREATE DATABASE データベース名
*** データベースを表示する [#j9c0a1c4]
[root@www ~]# mysqlshow -uroot -p
Enter password:
+--------------------+
| Databases |
+--------------------+
| information_schema |
| mysql |
| test |
| webdb1 |
+--------------------+
MySQLのプロンプト内で
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
| webdb1 |
+--------------------+
5 rows in set (0.00 sec)
->
とすることもできます。
***データベース情報を表示する [#j291d710]
[root@www ~]# mysqlshow webdb1 -p -uroot
Enter password:
Database: webdb1
+--------+
| Tables |
+--------+
| rss |
+--------+
MySQLのプロンプト内で、
mysql> use webdb1;
Database changed
mysql> show tables;
+------------------+
| Tables_in_webdb1 |
+------------------+
| rss |
+------------------+
1 row in set (0.00 sec)
とすることもできます。
***テーブル情報を表示する [#z88c039d]
[root@www ~]# mysql webdb1 -p -uroot
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 53 to server version: 5.0.15...
Type 'help;' or '\h' for help. Type '\c' to clear the bu...
mysql> describe rss;
+-------+------------------+------+-----+---------------...
| Field | Type | Null | Key | Default ...
+-------+------------------+------+-----+---------------...
| id | int(10) unsigned | NO | PRI | NULL ...
| title | varchar(255) | YES | | ...
| link | text | YES | | NULL ...
| date | datetime | NO | | 0000-00-00 00:...
+-------+------------------+------+-----+---------------...
4 rows in set (0.00 sec)
mysql>
*** テーブル定義を参照する [#qc88633b]
テーブルがどの様なSQL文で作成されたか表示します。
mysql> show create table webdb1.rss;
--------------------------+
| Table | Create Table
--------------------------+
| rss | CREATE TABLE `rss` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(255) default '',
`link` text,
`date` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=ujis COMMENT='RSS List' |
+-------+-----------------------------------------------...
1 row in set (0.00 sec)
参考:~
http://www.rfs.jp/sitebuilder/sql/04/07.html#SHOW%20CREAT...
----
この記事は
#vote(おもしろかった[3],そうでもない[4])
#comment
#topicpath
SIZE(10){現在のアクセス:&counter;}
ページ名: