MYSQL in Three Minutes

Home

Contact

About 7B Software, Inc.

Professional Resume

Notable Hacks
from 7B Software

Programming Techniques
from 7B Software

Links and Resources

Computer Industry Predictions

I love the minimalist style of the sqlite database. By comparison, the MySQL database seems a bit more inaccessible. Lots of hard to read documentation--and overall, just too much information.

I thought I'd do the world a favor, therefore, and record, in as few commands as possible, how to start from nothing but a Fedora Linux system, and create a working MySQL installation. The goal is for you to get this done in under three minutes.

What this will do is:

  • Install the MySQL client and server packages.
  • Create two users: the 'root' user, and another one, named 'apache'.
  • Create a single database named 'mydata'.
  • Grant the 'apache' user privileges to the 'mydata' database.
  • Verify that the user can in fact use the database.

Time to start your watch! Ok, let's begin:

# yum install mysql mysql-server

# chkconfig mysqld on

# service mysqld start

# mysqladmin -u root password root

$ mysql -u root -p
Enter password: root

mysql> create database mydata;

mysql> create user apache;

mysql> grant all privileges on mydata.* to apache@"localhost" identified by 'apache';

mysql> exit

$ mysql -u apache -p
Enter password: apache

mysql> show databases;

mysql> use mydata;

mysql> create table foo(id INT);

mysql> insert into foo values(1);

mysql> select * from foo;

mysql> exit

And...Scene!

Mark Smith
7B Software, Inc.