Skip to content

Databases

MySQL Database Management in VS Code

DBCode is a MySQL extension for VS Code: connect, browse schemas and data, write queries with schema-aware autocomplete, and edit rows visually without switching tools. Install DBCode to get started, or see how it compares to standalone database tools.

MySQL is a widely used, open-source relational database management system (RDBMS) that provides a robust and reliable foundation for building and running complex applications. Known for its:

  • Performance optimizations: Fast query execution and caching mechanisms
  • Reliability: Proven stability across millions of deployments
  • Scalability: Support for very large databases and high-traffic applications
  • Comprehensive transactional support: ACID compliance with row-level locking
  • Robust security: Enterprise-grade authentication and encryption options

MySQL powers many of the world’s most visited websites and mission-critical applications with its combination of speed, reliability, and ease of use.

To connect to MySQL in DBCode:

  1. Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
  2. Add a New Connection: Click on the “Add Connection” icon.
  3. Complete connection form: Select MySQL as the database type and enter:
    • Host address (default port: 3306)
    • Authentication credentials (username/password)
    • Database name (optional)
    • SSL configuration (if required)
  4. Connect: Click save to connect to your MySQL database.
  5. Start Managing Your Database: Browse tables, views, and stored procedures.

For detailed instructions on connecting to MySQL, refer to the Connect article.

Many cloud providers offer MySQL as a managed service, including AWS RDS, Azure Database for MySQL, and Google Cloud SQL. To connect to a cloud provider and access multiple MySQL databases:

  1. Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
  2. Add a New Connection: Click on the “Add Connection” icon.
  3. Select Your Provider: Choose the appropriate cloud provider from the list.
  4. Authenticate: Complete the authentication process specific to the provider.
  5. Start Managing Your Databases: Access multiple MySQL instances through a unified interface.

For detailed instructions on connecting to MySQL cloud services, refer to the Connect a Cloud Provider article.

DBCode enhances your MySQL development experience with:

  • Visual stored procedure editor: Create and edit procedures with syntax assistance
  • Foreign key visualization: Easily understand table relationships
  • Data import/export tools: Transfer data between MySQL databases

By using MySQL with DBCode, you can efficiently develop, test, and manage your MySQL databases directly within Visual Studio Code.

DBCode shows MySQL scheduled events in an Events folder under each database, next to Tables and Views. Each event row shows its schedule and status, with the definer, start and end boundaries, and last run time in the tooltip.

  • Enable and disable: Right-click an event to enable or disable it. The row’s status and available action update immediately.
  • Edit definitions: Open an event to view or edit its CREATE EVENT statement, keeping its DEFINER clause intact.
  • Create events: Right-click the Events folder to create a new event from a template.

The Events folder appears only when Progressive Loading is enabled in the connection’s advanced settings. A connection that was already using Progressive Loading before events support keeps its cached schema, so refresh the database once to pick up the folder.

Two behaviors worth knowing:

  • Applying an edited event drops and recreates it. If the edited definition is rejected, the event is removed; the definition stays open in the editor to fix and re-apply.
  • Events only fire when the server’s event_scheduler is ON. DBCode surfaces it in the monitoring panel’s System Info, as a scheduler that is off is the most common reason an event never runs.

The Advanced section of the connection editor exposes pool tuning options alongside the existing Editor Connection Idle Timeout setting.

The maximum number of concurrent connections DBCode opens per database for this connection. The default is 10.

Lower this value when the server enforces a per-user connection limit (MySQL max_user_connections). A lower ceiling serializes concurrent queries rather than returning an error when the limit is reached.

How long an idle pooled connection is kept open before it is closed, in seconds. The default is 300 seconds.

Lower this value to release connections sooner on servers with a tight connection limit.

For more information about MySQL, check out MySQL.