我不知道如何使用PDO在
PHP中获取MySQL数据库的列表,而不必先连接到数据库(我的意思是在dsn中没有dbname)?
通常我以前使用mysql_list_dbs()函数,但是我不再以这种方式使用mysql.
您可以使用
show databases
或对information_schema的查询:
select schema_name from information_schema.schemata
我不知道如何使用PDO在 PHP中获取MySQL数据库的列表,而不必先连接到数据库(我的意思是在dsn中没有dbname)? 通常我以前使用mysql_list_dbs()函数,但是我不再以这种方式使用mysql. 您可以使用 show databases 或对information_schema的查询: select schema_na
我不知道如何使用PDO在
PHP中获取MySQL数据库的列表,而不必先连接到数据库(我的意思是在dsn中没有dbname)?
通常我以前使用mysql_list_dbs()函数,但是我不再以这种方式使用mysql.
您可以使用
show databases
或对information_schema的查询:
select schema_name from information_schema.schemata