如何在不知道表名和列名的情况下从mysql数据库中获取所有内容?

I have a mysql database on an external domain. Phpmyadmin is not installed on the server. I do neither know the table names nor do I know the column names. Is there a way to somehow create a view in PHP that shows me everything that is in the db with all the column and table names?

You can query the INFORMATION_SCHEMA.COLUMNS table:

SELECT TABLE_NAME, COLUMN_NAME
FROM   INFORMATION_SCHEMA.COLUMNS
WHERE  TABLE_SCHEMA = DATABASE()

on mysql command you can use show databases and show tables

or on php script you can use mysql_list_dbs() and mysql_list_tables()

http://php.net/manual/en/function.mysql-list-dbs.php

http://php.net/manual/en/function.mysql-list-tables.php

This script uses the PDO to execute the queries which return the database tables and tables columns. It uses a simple layout that you can personalize.

<?php

    $host = '';
    $dbname = '';
    $username = '';
    $password = '';

    $db = new PDO("mysql:host=$host;dbname=$dbname;charset=UTF-8", $username, $password);

    $sth = $db->prepare("SHOW TABLE STATUS FROM $dbname");
    $sth->execute();

    $result = $sth->fetchAll();
    foreach ($result as $info) {
        echo "<p><b>".$info['Name']."</b><br />";

        $sth2 = $db->prepare("SHOW COLUMNS FROM $dbname.{$info['Name']};");
        $sth2->execute();
        $result2 = $sth2->fetchAll();
        foreach ($result2 as $info2)
            echo " - ".$info2['Field']."<br />";

        echo "</p>";
    }

?>