Loading
The programmer can work with the database through the console, but this does not mean that he should do so. There are many great clients for working with SQL servers. For example, I like SQLYog. Someone hardcore continues to work through the console, and many - immediately through Intellij IDEA.
Yes, she also knows how to personally work with SQL servers. But since we are studying MySQL here, at the same time we will learn how to use the MySQL Client, which often comes with it in tandem. It's called MySQL Workbench.
In theory, Workbench was installed along with MySQL in the last lecture. But if suddenly it is not on your computer, follow the instructions below.
Step 1. Let's follow the link again and then select the link at the very bottom. As a result, you should see something like this:
![](https://cdn.codegym.cc/images/article/93d4d683-ce4f-4cbf-a7fa-67f4bd7ac4cc/512.jpeg)
Step 2. Select MySQL Workbench and get the opportunity to choose a version for any operating system:
![](https://cdn.codegym.cc/images/article/444e135f-28e2-4a1e-aae4-ab1daeefa187/800.jpeg)
Download it and run the installation.
Installation
Step 1. We start the installation and see the standard window, click Next:
![](https://cdn.codegym.cc/images/article/aa9b3bdb-fb8f-4720-88c9-88a9ad1bf68a/512.jpeg)
Step 2. Select a directory to install the program.
![](https://cdn.codegym.cc/images/article/495e8ce5-a66e-4381-826c-0e2d03ced2d8/512.jpeg)
Step 3. Choose a standard configuration:
![](https://cdn.codegym.cc/images/article/a8c95029-cd21-4c1c-8b5e-e8b90b9f38f4/512.jpeg)
Step 4. Install:
![](https://cdn.codegym.cc/images/article/56426643-6d46-4c3d-be96-bbe06a1370ef/512.jpeg)
Step 5. In case of successful installation, you will see a window:
![](https://cdn.codegym.cc/images/article/9e5db0f2-1ae2-4a0c-85d6-226998d5f066/512.jpeg)
You will also receive an offer to launch Workbench. Let's see what's behind this...
Connecting to the database
Here we can see the start window of the program. There is a root user connection here. Click on it and enter the password that we set earlier.
![](https://cdn.codegym.cc/images/article/8767d32d-2ede-45ef-bb59-5c4dd2405323/1024.jpeg)
If you want to create a new connection, click the circled plus sign or use the top menu: Database -> Connect to database
.
![](https://cdn.codegym.cc/images/article/10aa2fa6-60ce-492a-b8ff-89e5831dce13/1024.jpeg)
With Workbench you can connect to any SQL server in the world, so you need to specify:
- 3-its address: host & port
- 4-username
- 5-password (you will be asked to specify later)
Actually, you need to choose a connection name(2) - you can write any one you like, and also select Database Scheme.
Tables in the database are combined into groups - schemas. In a sense, these are databases. That is, one schema is one database.
On the other hand, tables from one schema can reference tables from another schema, they can be JOINed and the like. So a schema is still a group of tables. Similar to packages in Java. Classes within the same package are more closely related to each other, but at the same time, nothing prevents them from referencing classes from other packages.
How to view a list of databases
After the completed manipulations, a connection to the server will occur and you will see the workspace of the MySQL Workbench environment in front of you.
![](https://cdn.codegym.cc/images/article/4e0a1129-24a2-4338-b9cd-9b4868b3656f/1024.jpeg)
Let's open the list of databases (schemas) on the server we connected to. To do this, open the Schemas tab. Now click and expand the list of plates in the “sakila” scheme.
![](https://cdn.codegym.cc/images/article/1823d940-d64c-437d-806e-9e4c500f724b/1024.jpeg)
Enter the following SQL query: SELECT * FROM sakila.actor
![](https://cdn.codegym.cc/images/article/c70bbe64-6159-4e80-be40-3b6b830ff62a/1024.jpeg)
Everything works, is there a result of the request? Great, Workbench is installed and working correctly.