Creating Databases and Accounts on a MySQL Server

MySQL is an open source database system that has become very popular due to its high performance, lightweight design, and open source license.

Many software packages, including web applications such as the Serendipity blog software (http://www.s9y.org/), use MySQL to store data. In order to use these programs, you will need to create a MySQL database and access account.

How Do I Do That?

First, you’ll need to select names for your database and access account; for this example, let’s use chrisblog for the database name and chris for the access account. Both names should start with a letter, contain no spaces, and be composed from characters that can be used in filenames.

To create the database and account, use the mysql monitor program:

# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.18

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database chrisblog;
Query OK, 1 row affected (0.01 sec)

mysql> grant all privileges on chrisblog.* to 
               
                  'chris'
               
               @'localhost' 
               identified by 
               
                  'SecretPassword'
               
               ;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

Tip

Make sure that the mysqld service is running!

You can then enter the database, access account, and password information into the configuration of whatever software will use MySQL.

Warning

MySQL recommends that you add a password to root’s access of the MySQL server. You can do that with ...

Get Fedora Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.