How to Use MySQL Workbench to Manage Databases
What is MySQL Workbench
MySQL Workbench is an official MySQL database design and management tool that provides an integrated development environment for database design, SQL development, database management, data migration, and more. MySQL Workbench has the following notable advantages:
- Comprehensive Features: MySQL Workbench integrates all functions of database design, development, and management.
- User-Friendly: It provides an easy-to-use graphical interface to help users perform various database operations effortlessly.
- High Performance: MySQL Workbench focuses on performance optimization and can process large-scale data quickly.
- Cross-Platform Support: MySQL Workbench supports Windows, macOS, and Linux operating systems.
For developers, MySQL Workbench not only improves work efficiency but also simplifies the complexity of database management.
Managing ServBay Built-in MariaDB (MySQL) Database Using MySQL Workbench
Logging into the Server
- Download and Install MySQL Workbench: Download and install the MySQL Workbench client for your operating system from the MySQL official website.
- Create a New Connection:
- Open MySQL Workbench, click the "+" button on the homepage to create a new connection.
- Enter Connection Information:
- Username and Password: These can be obtained from ServBay's 'Settings' - 'Database'.
- Port:
3306
(Note: You only need to choose either Port or Socket) - Socket:
/Applications/ServBay/tmp/mysql.sock
- Other information such as the database name can be left blank and selected later.
- Test Connection and Save: Click the "Test Connection" button to ensure the connection information is correct, then click the "OK" button to save the connection.
Creating a Database
- Enter Database Management Interface: After successfully logging in, click the "Schemas" tab on the left.
- Create a New Database:
- Right-click the empty area under "Schemas", select "Create Schema..."
- Enter the database name.
- Click the "Apply" button to create the database.
Creating a Table
- Select Database: Expand the newly created database from the list on the left.
- Create a Table:
- Right-click the "Tables" and select "Create Table..."
- Enter the table name and field information (such as field name, type, length, default value, etc.).
- Click the "Apply" button to create the table.
Adding Data
- Select Table: Select the table you want to operate on from the list on the left.
- Insert Data:
- Right-click the table name, select "Select Rows - Limit 1000"
- In the result view, click the "Apply" button to insert a new row.
- Enter data values.
- Click the "Apply" button to save the data.
Querying Data
- Select Table: Select the table you want to operate on from the list on the left.
- Browse Data:
- Right-click the table name, select "Select Rows - Limit 1000"
- In the result view, you can directly view the data in the table.
- You can also use the SQL query function for data filtering.
Updating Data
- Select Table: Select the table you want to operate on from the list on the left.
- Edit Data:
- Right-click the table name, select "Select Rows - Limit 1000"
- In the result view, double-click the data row you want to modify.
- Modify data values.
- Click the "Apply" button to save the changes.
Deleting Data
- Select Table: Select the table you want to operate on from the list on the left.
- Delete Data:
- Right-click the table name, select "Select Rows - Limit 1000"
- In the result view, choose the data row you want to delete.
- Right-click and select "Delete Row(s)"
- Click the "Apply" button to confirm the deletion.
Deleting a Table
- Select Database: Select the database containing the table you want to delete from the list on the left.
- Delete Table:
- Right-click the name of the table you want to delete, select "Drop Table..."
- Confirm the deletion operation.
Deleting a Database
- Select Database: Select the database you want to delete from the list on the left.
- Delete Database:
- Right-click the name of the database, select "Drop Schema..."
- Confirm the deletion operation.
Through the above steps, you can easily manage the MariaDB (MySQL) database bundled with ServBay using MySQL Workbench. The simple interface and powerful features of MySQL Workbench will greatly enhance your database management efficiency. Whether it is creating databases, tables, or inserting, querying, updating, and deleting data, MySQL Workbench provides a convenient operation experience.