docs/versioned_docs/version-2.50.0-LTS/data-sources/mysql.md
ToolJet can connect to MySQL databases to read and write data.
<div style={{paddingTop:'24px'}}>To establish a connection with the MySQL data source, you can either click on the + Add new Data source button located on the query panel or navigate to the Data Sources page through the ToolJet dashboard.
<div style={{textAlign: 'center'}}> </div>:::info Please make sure the Host/IP of the database is accessible from your VPC if you have self-hosted ToolJet. If you are using ToolJet cloud, please whitelist our IP. :::
ToolJet requires the following to connect to your MySQL database:
If you are using Hostname as the connection type, you will need to provide the following information:
If you are using Socket as the connection type, you will need to provide the following information:
Note: It is recommended to create a new MySQL database user so that you can control the access levels of ToolJet.
<div style={{textAlign: 'center'}}> </div> </div> <div style={{paddingTop:'24px'}}>Once the MySQL data source is added, you can create queries to read and write data to the database. You can create queries from the Query Panel located at the bottom panel of the app builder.
SQL mode can be used to query MySQL database using SQL queries.
Example:
SELECT * FROM users
GUI mode can be used to query MySQL database without writing queries.
Example:
{{ [ {id: 1, channel: 33}, {id:2, channel:24} ] }}
:::tip Query results can be transformed using transformations. Learn more about transformations here. :::
</div>