Home > Articles > Data > MySQL

Working with MariaDB

  • Print
  • + Share This
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.
This chapter is from the book

This chapter is from the book

Making the Connection

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 pieces of information:

  • The hostname (the name of the computer)—this is localhost if connecting to a local MariaDB server
  • The port (if a port other than the default 3306 is used)
  • A valid user name
  • The user password (if required)

As explained in Chapter 2, “Introducing MariaDB,” all this information can be passed to the mysql command line utility, or entered into the server connection screen in MySQL Workbench.

After you are connected, you have access to whatever databases and tables your login name has access to. (Logins, access control, and security are revisited in Chapter 28, “Managing Security.”)

  • + Share This
  • 🔖 Save To Your Account