MySQL入門--查詢資料庫資訊

panpong發表於2017-01-10

查詢資料庫資訊mysqlshowshow databases

[root@vm1 ~]# mysqlshow -uroot -p

Enter password:

+--------------------+

|     Databases      |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

 

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.00 sec)

 

mysql> select db ,user,host from db;

+-----+-----------+-----------+

| db  | user      | host      |

+-----+-----------+-----------+

| sys | mysql.sys | localhost |

+-----+-----------+-----------+

1 row in set (0.00 sec)

 

顯示當前所在資料庫:

mysql> select database();

+------------+

| database() |

+------------+

| mysql      |

+------------+

1 row in set (0.00 sec)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16976507/viewspace-2132199/,如需轉載,請註明出處,否則將追究法律責任。

相關文章