Managing MySQL/MariaDB Databases with phpMyAdmin in ServBay
Overview: What is phpMyAdmin
phpMyAdmin is a widely-used open source database management tool specifically designed for managing MySQL and MariaDB databases through a web interface. It offers web developers an intuitive and user-friendly graphical interface, greatly simplifying routine database management tasks such as creating databases, tables, users, executing SQL queries, and importing/exporting data.
ServBay, a powerful local web development environment, comes with phpMyAdmin pre-integrated, allowing you to easily manage the MySQL or MariaDB database instances running in ServBay.
phpMyAdmin stands out due to several key advantages:
- Comprehensive Features: Supports most core MySQL and MariaDB functions, covering management of databases, tables, fields, indexes, user permissions, and more.
- User-Friendly: Offers a clear graphical interface, making it easy even for database beginners to get started quickly.
- Multi-Language Support: Supports various language interfaces for global users.
- Easy to Extend: Allows feature extension via plugins or scripts.
With phpMyAdmin, developers can focus more on building application logic without spending unnecessary time managing databases via the command line.
Accessing the Integrated phpMyAdmin in ServBay
ServBay includes phpMyAdmin by default, and you can easily access it via the local address provided by ServBay.
When ServBay is running, open your web browser and visit:
https://servbay.host/phpmyadmin
Note that servbay.host
is ServBay's default local domain, resolved to the ServBay welcome page and integrated tools (such as phpMyAdmin) by ServBay's built-in Caddy/Nginx server. Make sure ServBay is running, and that both the web server (Caddy or Nginx) and the relevant database package (MySQL or MariaDB) are enabled.
Logging in to phpMyAdmin
To start managing your databases, you need to log in to phpMyAdmin with the correct credentials.
- Open your browser: Visit the phpMyAdmin URL
https://servbay.host/phpmyadmin
. - Enter your login details: On the login page, enter your username and password.
- Username and Password: You can find ServBay’s default database user (usually
root
) and its password in the Databases tab of the ServBay app interface. For security, it’s recommended to change the default root password after your first login. - Server: Usually, you can input
default
or select a specific database version you wish to connect to (e.g.MariaDB-10.6
orMySQL-8.0
).default
generally points to ServBay's currently active database version.
- Username and Password: You can find ServBay’s default database user (usually
- Login: Click the “Login” button to enter the phpMyAdmin management interface.
Managing ServBay Databases with phpMyAdmin
Once logged in, you can perform a wide range of database management tasks through phpMyAdmin’s graphical interface. Here are the typical operation steps:
Creating a New Database
A common first step for your project is to create a separate database.
- In phpMyAdmin’s left navigation panel, click New or select the Databases tab in the main area.
- In the “Create database” section, enter your desired database name (e.g.
servbay_project_db
). - In the “Collation” dropdown, select your preferred character set and collation—
utf8mb4_unicode_ci
is usually recommended for broad character support (including emojis). - Click the Create button.
Creating a New Table
After creating your database, you can define its structure by creating tables.
- Click your newly created database name in the left sidebar.
- In the database structure view, find the “Create table” section.
- Enter the table name (e.g.
users
) and specify the number of fields you need. - Click Create.
- On the next page, define each field’s attributes, including:
- Name: Field name (e.g.
id
,username
,email
,created_at
). - Type: Data type (e.g.
INT
,VARCHAR
,TEXT
,DATETIME
). - Length/Values: Set the length according to the data type (e.g.
VARCHAR(255)
). - Default: Set a default value (optional).
- Index: Set as PRIMARY (primary key), UNIQUE, INDEX, etc. Usually, make
id
field PRIMARY and AUTO_INCREMENT. - A_I: Check this for auto-increment (often used for the primary key).
- Name: Field name (e.g.
- After defining all fields, scroll to the bottom and click Save.
Inserting Data
Add new records to your table.
- In the left panel, select the table you wish to insert data into.
- Click the Insert tab at the top menu.
- Fill in the values to insert. You can insert multiple rows at once.
- At the bottom, click Go.
Querying and Browsing Data
View existing data in your tables or run custom queries.
- In the left navigation, select the table to browse.
- Click the Browse tab in the top menu; this will display the first few rows of data.
- For advanced queries, click the SQL tab, enter your SQL statement (e.g.,
SELECT * FROM users WHERE username = 'servbay-demo';
), and click Go.
Updating Data
Modify existing records in your table.
- In the left navigation, select the table whose data you need to update.
- Go to the Browse tab to find the row you want to change.
- Once you find the target row, click the Edit icon (usually a pencil) beside it.
- Update the necessary field values.
- Click Go at the bottom to save your changes.
Deleting Data
Remove records from a table.
- In the left panel, select the desired table.
- Go to the Browse tab to find the row(s) you want to delete.
- Check the checkbox(es) to the left of the target row(s).
- You can select multiple rows for batch deletion.
- Click the Delete icon (usually an X), or if you have selected multiple rows, choose Delete from the dropdown at the bottom and click Go.
- Confirm the deletion.
Dropping a Table
Delete an entire table and all its data.
- In the left sidebar, select the database containing the table you want to remove.
- In the database structure view, find your target table.
- Check the box to the left of the table.
- Find the Drop action at the bottom of the table list and click Go.
- Confirm the deletion. Note: Dropping a table permanently removes all its data.
Dropping a Database
Remove an entire database and all of its tables/data.
- In the left sidebar, select the database you want to drop.
- Click the Operations tab at the top menu.
- Scroll down to the “Drop the database” section and click Drop the database.
- Confirm the deletion. Note: Dropping a database permanently erases all data and is irreversible.
Frequently Asked Questions (FAQ)
- Q: Why can’t I access
https://servbay.host/phpmyadmin
?- A: Please ensure the ServBay app is running, and that the web server (Caddy or Nginx) and the appropriate database package (MySQL or MariaDB) are enabled in the ServBay control panel. Also, check whether your system hosts file has been modified by other software, or try restarting ServBay.
- Q: Where can I find the database username and password?
- A: The default database root user password can be found in the Databases tab of the ServBay app. Please refer to How to obtain your database root account password and connection info.
- Q: What should I do if I forgot the root password?
- A: ServBay offers a function to reset the database root password. You can find the reset button in the Databases tab of the ServBay app. After clicking it, ServBay will generate and display a new default root password for your selected database (MySQL or MariaDB).
- Q: Can phpMyAdmin connect to PostgreSQL or MongoDB in ServBay?
- A: phpMyAdmin is designed specifically for managing MySQL and MariaDB; it does not support PostgreSQL or MongoDB.
Conclusion
With ServBay’s integrated phpMyAdmin, you can efficiently and intuitively manage MySQL and MariaDB databases in your local development environment. From basic creation and deletion of databases/tables to inserting, querying, updating, and deleting data, phpMyAdmin’s graphical interface greatly reduces the complexity of database administration. Coupled with ServBay’s convenient environment management features, you can enjoy a smoother web application development and debugging experience.