功能:利用mysql和mysqli兩種連接配接資料庫的方法,取得Mysql伺服器上的所有資料庫和庫中的所有表。
環境:自己用分開安裝apache mysql php搭建的環境
作業系統是:windows 10
代碼如下:
結果如下:
0=>information_schema
CHARACTER_SETS
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
ENGINES
EVENTS
FILES
GLOBAL_STATUS
GLOBAL_VARIABLES
KEY_COLUMN_USAGE
PARAMETERS
PARTITIONS
PLUGINS
PROCESSLIST
PROFILING
REFERENTIAL_CONSTRAINTS
ROUTINES
SCHEMATA
SCHEMA_PRIVILEGES
SESSION_STATUS
SESSION_VARIABLES
STATISTICS
TABLES
TABLESPACES
TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TRIGGERS
USER_PRIVILEGES
VIEWS
INNODB_BUFFER_PAGE
INNODB_TRX
INNODB_BUFFER_POOL_STATS
INNODB_LOCK_WAITS
INNODB_CMPMEM
INNODB_CMP
INNODB_LOCKS
INNODB_CMPMEM_RESET
INNODB_CMP_RESET
INNODB_BUFFER_PAGE_LRU
1=>access_control
collection
collection2permission
permission
signup
user
user2collection
2=>db_bcty365
tb_bb
tb_bbqb
tb_bbs
tb_bccd
tb_bccdjj
tb_city
tb_cjwt
tb_dd
tb_leaveword
tb_reply
tb_sjxz
tb_soft
tb_tell
tb_type
tb_type_big
tb_type_small
tb_user
tb_xlh
3=>db_nethard
tb_member
tb_upfile
tb_uptype
4=>db_reglog
5=>mysql
columns_priv
db
event
func
general_log
help_category
help_keyword
help_relation
help_topic
host
ndb_binlog_index
plugin
proc
procs_priv
proxies_priv
servers
slow_log
tables_priv
time_zone
time_zone_leap_second
time_zone_name
time_zone_transition
time_zone_transition_type
6=>performance_schema
cond_instances
events_waits_current
events_waits_history
events_waits_history_long
events_waits_summary_by_instance
events_waits_summary_by_thread_by_event_name
events_waits_summary_global_by_event_name
file_instances
file_summary_by_event_name
file_summary_by_instance
mutex_instances
performance_timers
rwlock_instances
setup_consumers
setup_instruments
setup_timers
threads
7=>php_study
8=>phpbook
addressbook
9=>regi
member
10=>test
11=>world
city
country
countrylanguage
Array ( [0] => information_schema [1] => access_control [2] => db_bcty365 [3] => db_nethard [4] => db_reglog [5] => mysql [6] => performance_schema [7] => php_study [8] => phpbook [9] => regi [10] => test [11] => world )
本文轉自孤舟夜航之家部落格51CTO部落格,原文連結http://blog.51cto.com/cysky/1693826如需轉載請自行聯系原作者
cysky