Tutorial: Install MySQL on your raspberry pi

Mysql database is lightweight and fast. It's also free! I use MySQL for all my pi projects which need a database. If you plan on setting up your pi as a web server then this is a must have. If your pi is new and fresh out of the box, follow my Quick setup guide

What you will need

Two commands and you are off and running!

The first command will install the mysql-server itself. During installation, you will be asked to set a root password. This can be anything or it can even be blank.

The second command will secure your installation. Security is important! You can remove the extra accounts, etc that come with mysql by default in this step.

  • sudo apt-get install mysql-server
  • sudo mysql_secure_installation

Create your first database!

  • mysql -u root -p (you will be asked to enter your pasword)
  • create database thispi;
  • show databases;

Thats it! Now you have mysql setup and have a new database created!!