MySQL administration learning project using PHP PDO

This project demonstrates how PDO can read MySQL server information, list databases and tables, inspect table structures and display records without hard-coding every column name.

Development use only: this project can expose database metadata and includes destructive operations such as emptying or dropping tables. Keep it off the public web, protect access, use a least-privilege database account, and never place root credentials in a publicly reachable project.

How the project is organized

Set the database connection in config.php using the approach described in the PDO connection tutorial, then open index.php. The menu passes the selected database and table between the project pages. For new deployments, use a dedicated database account with only the permissions needed for the task.

What the project shows

The home page can display server information such as the MySQL version and operating environment.

SHOW VARIABLES LIKE '%version%';

The database page lists databases that the configured MySQL account is allowed to see.

SHOW DATABASES;
Listing MySQL databases

See also listing MySQL databases.

After selecting a database, the tables page can list the available tables.

SHOW TABLES;
Listing tables in a MySQL database

See listing tables in MySQL.

Displaying records and table structure

The record page reads the table's columns so the same display logic can be reused across different tables. See displaying MySQL field names. The structure page can read metadata from INFORMATION_SCHEMA.COLUMNS. Values such as schema and table names should be validated against known/allowed identifiers before being used elsewhere in dynamic SQL.

Showing records from a table Showing the structure of a MySQL table
SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = :table_name
  AND table_schema = :database_name;

See also reading MySQL field types. Use a prepared statement for these metadata values. For SQL identifiers used in commands where placeholders are not accepted, validate them against an allowlist obtained from the server rather than accepting arbitrary request text.

Destructive operations

The original project includes links that can empty records or drop a table after confirmation. A browser confirmation is only a user-interface safeguard; authorization must also be enforced on the server. Keep destructive features disabled unless they are specifically needed in an isolated development environment.

Delete and empty table controls in the project

Files used by the project

config.php stores connection settings, menu.php prepares navigation parameters, database.php lists databases, show-tables.php lists tables, show-records.php displays records, and show-structure.php displays column metadata.

How to use the downloadable project

1. Download and extract the ZIP in a local or protected development environment.
2. Open config.php and enter credentials for a least-privilege MySQL account.
3. Open index.php and browse only the databases that account is permitted to access.
4. Keep destructive include/actions disabled unless you intentionally need them.
5. Do not publish the project as an unrestricted database administration interface.

Download plus-mysqladmin.zip




Subscribe to our YouTube Channel here



plus2net.com







keroles rafat

27-09-2014

when i click empty or delete nothing happened?why
smo

27-11-2014

For safety , the part of the code is commented to prevent accidental deletion of records. Search for this line in show-table.php file. Check that this line is not commented.
include "drop-empty-table.php"; // Code to delete records and drop table //
iqa

20-10-2017

can this script be used to display database and tables from postgresql? because i already edit the config.php and still can't display the table and databases name
smo1234

22-10-2017

Connecting string is different for different database. The functions at script level in pages for getting the data by using Query is also different. So it will not work.
Rejencra Bardol

12-10-2018

plus-mysqladmin project is wonderful sir,
well done... Thanks for such a wonderful tool for young developers like me.

Once again Thanks..




PHP video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2026   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer