Working with MySQL Workbench
In this article, I am going to discuss how to connect with MySQL Database Server using the Workbench tool i.e. Working with MySQL Workbench. Please read our previous article, where we discussed the basic concepts of MySQL Database.
What is MySQL Workbench?
While installing MySQL we also installed the MySQL workbench tool. MySQL Workbench is a unified visual tool for database architects, developers, and Database Administrators. MySQL Workbench provides data modeling, SQL development, and comprehensive administration tools for server configuration, user administration, backup, and much more. MySQL Workbench is available for all major operating systems like Windows, Linux, and Mac OS X.
Let’s learn about MySQL workbench with some practical examples. From my Windows 10 operating systems, I’ll go to ‘Start Menu’ -> ‘MySQL -> and then click on MySQL Workbench as shown in the below image.
Once you click on the MySQL Workbench, the following default screen for the MySQL Workbench tool will be opened.
Creating Database Connection in MySQL:
In the next step, we need to create a connection. To create a new connection in MySQL, we need to click on the + symbol which appeared next to the MySQL Connections as shown in the below image.
Once you click on the + symbol, it will open the below Setup new Connection window. Here, you need to give a name to your connection in the Connection Name text box. I provided the Connection Name as MyConnection. In the parameters tab, enter hostname. The hostname value can be localhost or the local IP address that is 127.0.0.1 or the IP address of your database server if it running somewhere else. In the Port number text box, enter the port number. If you installed MySQL on a different port, make sure to enter the exact port number here. The default port number is 3306. In the username text box, type the username you want to connect. Here we are going to connect to the MySQL database server using the ‘root’ username. So, I enter root in the username text box and then click on the OK button as shown in the below image.
Once you click on the OK button, the Database Connection is Created.
Connecting to the MySQL Database Server:
In the previous step, we just created one Database Connection i.e. MyConnection. Now, let us see how to connect to the database. In the top menu select the ‘Database’ -> ‘Connect to Database’ option as shown in the below image.
Once you select the Database => Connect to Database option, it will open the below Connect to Database window. In connect to database popup window select MyConnection from the Stored Connection drop-down and then click on the OK button as shown in the below image.
Once you click on the OK button, it will open the below Enter Password popup window. Here, you need to enter the root username password which you have set while installing MySQL Database. If you want, you can save the password for future use by checking the Save password in the vault checkbox and then click on the OK button to log in to the MySQL database server as shown in the below image.
Once you click on the OK button, you are logged into my MySQL database server, and MySQL workbench displays the default screen option.
In the center of the screen, we have 2 windows. In The left window, we can directly write, edit, save, or execute SQL statements. The SQL statements can Data definition or data manipulation language SQL statements. The right window provides help for SQL statements. You can select this option to read more about the practical topics as well as you can see the SQL syntax for the statement. The lower window displays all the actions performed on the database management system. In the left column window under Navigator. There is a management and instance section from where, you can manage server status, add users, back up, or restore databases. And under ‘schemas’, it displays all the existing databases, and finally, in the bottom left ‘information’ window we get brief information about each selected object.
In the next article, I am going to discuss how to create a new user in MySQL Database Server using Workbench. Here, in this article, I try to explain how to connect with MySQL Database Server using the Workbench tool and I hope you enjoy this article.