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:

Step 2. Select MySQL Workbench and get the opportunity to choose a version for any operating system:

Download it and run the installation.


Step 1. We start the installation and see the standard window, click Next:

Step 2. Select a directory to install the program.

Step 3. Choose a standard configuration:

Step 4. Install:

Step 5. In case of successful installation, you will see a window:

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.

If you want to create a new connection, click the circled plus sign or use the top menu: Database -> Connect to database.

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.

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.

Enter the following SQL query: SELECT * FROM sakila.actor

Everything works, is there a result of the request? Great, Workbench is installed and working correctly.