Skip to main content
LPI Linux EssentialsRaspberry Pi

Installing and Using Raspberry Pi MySQL

By May 11, 2014September 12th, 2022No Comments

Raspberry Pi MySQLIf you are studying for you LPI Linux Essentials then objective 1.2 will want to introduce to you some of the major open source software applications. As far as server applications the MySQL database server is one of the big ones. Acting as the back-end to many CMS, content management systems, such as Drupal, WordPress and Moodle you are likely to come across MySQL sooner rather than later, It is also the M in the LAMP  stack, Linux, Apache and PHP. As an alternative to MySQL you may also use the MariaDB.

Installing Raspberry Pi MySQL

For this video we will look at installing MySQL.

sudo apt-get update
sudo apt-get install mysql-server mysql-client

With this installed we will prompted to set the root account for MySQL. this is a separate account to the Linux root user and should have different passwords. We can login using the MySQL client:

mysql -u root -p

We will be prompted for the password.

We can create the new database

create database tup;
use tup;

The we will create the table:

create table users (
userid tinyint signed not null primary key auto_increment,
username varchar(50)
);

With the table created we can add data to the table:

insert into users (username)
values('Bob');
select * from users;

So a quick introduction to MySQL.