Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
In MySQL, a Database (synonymous with a Schema) is the highest-level logical container that houses your tables, views, stored procedures, and triggers. Before creating any tables or storing customer records, you must master the fundamental Data Definition Language (DDL) commands for creating and inspecting databases.
SHOW DATABASES)To view all databases currently present on your MySQL server instance:
When you execute SHOW DATABASES; on a fresh MySQL instance, you will notice several default system databases:
information_schema: A virtual metadata database providing read-only tables describing table structures, column types, and server privileges.mysql: The internal administrative core storing user accounts, password hashes, and global access permissions.performance_schema: An engine that monitors low-level server performance metrics, mutex latencies, and thread execution timings.sys: A set of user-friendly administrative views built on top of performance_schema for DBAs.mysql or information_schema system databases!CREATE DATABASE)The basic syntax to create a new database is:
In production environments, you should always include character set specifications and safety checks:
IF NOT EXISTS: Prevents an error from halting your script if the database already exists.CHARACTER SET utf8mb4: Guarantees full 4-byte UTF-8 encoding (mandatory for supporting all international scripts, Hindi/Devanagari, mathematical symbols, and modern emojis).COLLATE utf8mb4_unicode_ci: Defines the alphabetical sorting and comparison rules (case-insensitive Unicode standard).When naming databases, adhere strictly to industry standards:
my_company_db rather than MyCompanyDb).select, table, or database. If necessary, wrap names in backticks (`` database ``).information_schemaInstead of just running SHOW DATABASES;, you can query the database list with standard SQL filters:
latin1 or utf8 (which in MySQL was limited to 3-byte characters). Always explicitly specify utf8mb4.IF NOT EXISTS in CI/CD migration scripts.utf8mb4 preferred over older utf8 (utf8mb3) encoding in MySQL?COLLATE clause when creating a database?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Writing & Running Your First SQL Script | Selecting & Dropping Databases |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.