pdo get db name code example Example: php pdo get database name $pdo->query('select database()')->fetchColumn();