Online Book Reader

Home Category

MariaDB Crash Course - Ben Forta [10]

By Root 537 0
—Used to connect and actually perform database and table operations, including executing SQL statements. If you opt to use MySQL Workbench with this book, the Open Connection To Start Querying option is what you use.

• Data Modeling—Used to create and manage database and table structures. This is not covered in this book.

• Server Administration—Used to manage the MariaDB server, including stopping and starting the services, importing and exporting data, and more.

* * *

Tip: Saving Connections

MySQL Workbench needs to know information about your MariaDB server before it can open a connection to the server for you to use. At a minimum, this information includes the server address (hostname or IP address) and login information. Rather than having to enter this every time you use MySQL Workbench, you can save the details for future use (next time you just double-click on the saved settings to connect).

* * *

The SQL Editor screen is accessed via Open Connection To Start Querying in the SQL Development options. This is where you can type and execute SQL statements. Note the following:

• SQL statements are typed into the window at the top of the screen. When the statement has been entered, click the Execute button (the one with the yellow lightning bolt on it) to submit it to MySQL for processing.

• Generated results (if there are any) are displayed in a grid at the bottom of the screen, in a tab named Output.

• The leftmost tab in the bottom section of the screen, named Overview, lists all available databases (called schema here) and the tables within them. Click on any database to see its tables.

• You can right-click on tables to have MySQL Workbench write SELECT and other statements for you.

• The rightmost tab is a History tab that maintains a history of executed SQL statements. This is useful when you need to test different versions of SQL statements.

• You can have multiple SQL Editor windows open at the same time, each in its own tab, allowing you to work with multiple databases or SQL statements at once.

* * *

Note: Execute Saved Scripts

You can use MySQL Workbench to execute saved scripts—the scripts used to create and populate the tables used throughout this book, for example. To do this, select File, Open Script; select the script (which will be displayed in a new tab); and click the Execute button. Appendix B walks you through this process for the chapters in this book.

* * *

Summary


In this chapter, you learned exactly what MariaDB is. You were also introduced to two client utilities (one included command line utility, and one optional but highly recommended graphical utility).

3. Working with MariaDB

In this chapter, you learn how to connect and log in to MariaDB, how to issue MariaDB SQL statements, and how to obtain information about databases and tables.

Making the Connection


* * *

Note: Example Tables Required

From this point on, all chapters will use the example databases and tables. If you have yet to install these, see Appendix B, “The Example Tables,” before proceeding.

* * *

Now that you have a MariaDB DBMS and client software to use with it, it would be worthwhile to briefly discuss connecting to the database.

MariaDB, like all client-server DBMSs, requires that you log in to the DBMS before being able to issue commands. Login names might not be the same as your network login name (assuming that you are using a network); MariaDB maintains its own list of users internally and associates rights with each.

When you first installed MariaDB, you may have been prompted for an administrative login (usually named root) and a password (if you weren’t, then the root user account was created with no password). If you are using your own local server and are simply experimenting with MariaDB, using this login is fine. In the real world, however, the administrative login is closely protected (as access to it grants full rights to create tables, drop entire databases, change logins and passwords, and more).

To connect to MariaDB you need the following

Return Main Page Previous Page Next Page

®Online Book Reader