👉 When MySQL is installed, it automatically creates some databases. These databases are not for your application data. They are used by MySQL itself to work properly.
When you run:
SHOW DATABASES;
You usually see something like:
information_schema
mysql
performance_schema
sys
Let’s understand each one clearly.
👉 A read-only system database that stores metadata (Data about your databases)
- List of databases
- List of tables
- List of columns
- Index information
- Constraints
📌 Example:
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'sakila';
- ❌ You cannot insert data
- ❌ You cannot delete tables
- ✅ You only query it
🧠 Think of it as MySQL’s “dictionary”
👉 The most critical internal database It stores user accounts and permissions.
- Users and passwords
- Privileges
- Roles
- Authentication info
📌 Example:
SELECT user, host FROM mysql.user;
⚠️ Do NOT modify tables manually- ❌ Do not store application data here
- 🔐 Used by MySQL for security
🧠 Think of it as MySQL’s “security office”
👉 A database used to monitor MySQL performance.
- Slow queries
- Locks
- Threads
- Memory usage
- Query execution stats
📌 Example:
SELECT * FROM performance_schema.events_statements_summary_by_digest;
- Used by DBAs
- Helps tune performance
- Not required for daily app work
🧠 Think of it as MySQL’s “monitoring dashboard”
👉 A helper database built on top of performance_schema
Provides easy-to-read views.
performance_schema tables are:
- Large
- Complex
- Hard to query
sys simplifies them.
SELECT * FROM sys.user_summary;
This gives human-readable performance info.
- Contains views, not real tables
- Safe to query
- Meant for diagnostics
🧠 Think of it as MySQL’s “report generator”
| Database | Purpose | Can You Store Data? |
|---|---|---|
| information_schema | Metadata | ❌ No |
| mysql | Users & permissions | ❌ No |
| performance_schema | Performance metrics | ❌ No |
| sys | Simplified performance views | ❌ No |
👉 In your own database
Example:
CREATE DATABASE app_db;
USE app_db;
Then create tables there.
❌ Creating tables in mysql
❌ Deleting sys database
❌ Trying to insert rows into information_schema
❌ Treating system databases like normal databases
System databases are for MySQL User databases are for YOU