MySQL allows us to connect with the database server in mainly two ways:
Using Command-line Tool
We can find the command-line client tool in the bin directory of the MySQL’s installation folder. To invoke this program, we need to navigate the installation folder’s bin directory and type the below command:
- mysql
Next, we need to run the below command to connect to the MySQL Server:
- shell>mysql -u root -p
Finally, type the password for the selected user account root and press Enter:
- Enter password: ********
After successful connection, we can use the below command to use the:
- USE database_name;
Using MySQL Workbench
We can make a connection with database using MySQL Workbench, simply clicking the plus (+) icon or navigating to the menu bar -> Database -> Connect to Database, the following screen appears. Now, you need to fill all the details to make a connection:

Once we finished this setup, it will open the MySQL Workbench screen. Now, we can double click on the newly created connection to connect with the database server.