InfoWorld how-to's

How-to: Get started with MariaDB

An easy step-by-step guide to setting up a MariaDB database server and phpMyAdmin on Fedora, CentOS, or Ubuntu

InfoWorld how-to's

Show More
1 2 Page 2
Page 2 of 2

Locate the following line: 

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Enter a secret between the quotes, like this:

$cfg['blowfish_secret'] = 'SDJkjshdkfjhsdf9**&^%^&%'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

The secret can be anything, preferably a random string. You will not need to use this secret anywhere else; it’s an internal requirement. Save the file with Ctrl-O and exit with Ctrl-X.

Now we can log in to phpMyAdmin by pointing a Web browser at the server URL:

http://<server IP address>/phpmyadmin

Connecting to phpMyAdmin

When you connect to phpMyAdmin, you will be presented with a login dialog. By default, phpMyAdmin will connect to the localhost MariaDB instance, not a remote instance, so this username and password must be either the root user or a user with sufficient privileges as noted above.

Once you’ve logged in, you should see a list of databases on the left, along with configuration and management options on the right. Clicking on a database will allow you to browse through the database contents, add and delete tables and data, import and export data and database schemas, and perform various other administrative tasks. Be careful that you don’t perform actions that you are unsure about, such as dropping (deleting) a database.

There are a few tips you should know about phpMyAdmin to get started. First is a method of backing up or exporting a database to a file on your local system. To do this, click the database name in the list on the left, then click the Export tab at the top. In most cases you won’t need to change any of the options, but simply click the box next to the "Save as file" option near the bottom, select a compression type if desired, then click Go. This will cause the entire database to be exported, possibly compressed, and downloaded to your computer through the browser.

Another handy tip is the converse operation, which will import data from a backup into a new database. First, create the new database by clicking on the Home icon at the top left, then click Databases. Enter a name for the new database in the text field, select a collation if you know it, and click Create. The new database will appear in the list on the left.

Now, click the name of the new database, and click Import at the top. Click to browse for the backup file and select it, then click Go. This will automatically import the backup into the new database.

You can also create and manage database users with phpMyAdmin. Click the Home icon in the upper left and select Privileges. You can add a user here by filling out the form and specifying the username and password. If you want the user to have global privileges, you can select them here, but if this is a user for one specific database, leave those check boxes blank. Once the user has been created, click Privileges again, and click the Edit icon to the right of that username.

Next, select a database under "Database-specific privileges" and grant that user whatever rights are necessary. You can use the Check All link to allow that user all privileges on the database, or you can get more granular if necessary.

PhpMyAdmin also offers views of the server status. Click the Home icon in the upper left, click Processes to see active MariaDB connections and processes, and click Status to see an exhaustive list of server traffic, query, and variable statistics. PhpMyAdmin will flag certain statistics in red if they’re potentially problematic, such as if the number of open tables is too large.

Next to each variable is a brief description of the variable and sometimes a suggestion of what might be causing a problem, such as the possibility that the table cache value is too small. This is a great way to learn about the MariaDB server settings and what they mean. All adjustments to these variables should be done in the my.cnf or server.cnf file, though some variables can be set while the server is running.

There are many more aspects to proper MariaDB operation, tuning, management, and administration, but this guide should succeed in taking you from a stock OS installation to a fully functional MariaDB server with an administrative Web-based GUI. You will likely want to peruse the MariaDB reference manuals for more information on the care and feeding of your MariaDB database server.

Copyright © 2014 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2