How to Connect to a Database with MySQL Workbench
by Shubham Batra
Hello, everyone, and welcome to Code2Night! In this article, we will delve into the topic of how to connect to database using MySQL Workbench. As developers, working with databases is an essential skill, and MySQL is a powerful tool that allows us to interact with MySQL databases seamlessly. Whether you're a beginner or an experienced coder, understanding how to establish a connection between your code and a database is crucial for building robust and dynamic applications.
Step 1. Open MySQL.
Step 2. Click on the + sign to set up a new connection
Step 3. In the “Set up a New Connection Dialogue” box, Type your Database connection credentials. The credentials will be like the following:
- Connection Name: You can name this whatever you like.
- Connection Method: Standard (TCP/IP).
- Hostname: You can use your domain our your cPanel IP address.
- Port: 3306
- Username: Your cPanel username or the user you created for the database.
- Password: cPanel password or the password for the database user that was created.
- Default Schema: This can be left blank.
Click Test Connection.
Step 4. Type your password and click the “Save Password in Vault” check box. Click Ok.
Step 5.MySQL Workbench should say “Connection parameters are correct“. Click Ok.
Step 6. Click Ok again to accept the connection settings
Step 7. After clicking ok Then you see the Database connection below
To open the database you have to Double-click on the EmployeeDb