Overview
This lecture provides a step-by-step guide on how to create a MySQL database and table using XAMPP and phpMyAdmin.
Installing XAMPP
- Download XAMPP from the official website, Apachefriends.org, for your operating system (Windows, Linux, etc.).
- Install XAMPP on your computer.
Starting Apache and MySQL in XAMPP
- Open the XAMPP application.
- Start both Apache and MySQL services from the XAMPP control panel.
Accessing phpMyAdmin
- Open your web browser and go to
localhost/xampp.
- Alternatively, access phpMyAdmin directly at
localhost/phpmyadmin.
- Use phpMyAdmin to manage your MySQL databases.
Creating a New Database
- In phpMyAdmin, click the “New” button to create a new database.
- Enter the database name (example:
student) and select the desired collation.
- Click “Create” to make the new database.
Creating a Table in the Database
- After database creation, enter a table name (example:
student) and specify the number of columns (e.g., 5).
- Define the table columns, such as:
- nim (student identification number), type: VARCHAR(20)
- name, type: VARCHAR(30)
- study program, type: VARCHAR(25)
- class, type: VARCHAR(20)
- address, type: VARCHAR(50)
- Set the appropriate column as the primary key (usually
nim).
Inserting Data into the Table
- Click on the table and select “Insert” to add data.
- Fill in the fields with student information and save the entry.
- Verify that the data appears in the table by browsing it.
Key Terms & Definitions
- XAMPP — A free, open-source web server package that includes Apache, MySQL, PHP, and phpMyAdmin.
- phpMyAdmin — A web-based tool for managing MySQL databases.
- Database — An organized collection of data stored and accessed electronically.
- Table — A structure in a database to store related data in rows and columns.
- Primary Key — A unique identifier for each record in a table.
Action Items / Next Steps
- Practice creating a database and table in XAMPP using phpMyAdmin.
- Try entering multiple data entries and using various data types.