Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

RPi MySQL

From eLinux.org
Jump to: navigation, search

Installing MySQL on Raspberry Pi

This is a guide to install MySQL Community Edition (aka "MySQL") on the Raspberry Pi computer running Debian "squeeze".

MySQL is comprised of two distinct components:

  • MySQL Server
    • The program that actually stores and processes the data.
      There is generally no way to interact with the data stored in the database server without using an external client or library.
  • MySQL Client
    • A program or library that connects to an existing MySQL database server.
      This is considered a "front end" to the database - a way for the user to send and retrieve data from the database server.

The guide has been developed/tested using debian6-19-04-2012. Depending on how you choose to install Ruby, there may not be enough room on a standard 2Gb image. This is especially true if you've already installed anything else. Learn how to expand your image here or here.

Installing MySQL Server From The Debian Repository

Commands

# Install MySQL Server from the Debian repository
sudo apt-get install mysql-server

The package manager may suggest a slew of dependencies for MySQL Server. Press "Y" then "enter" (or just "enter") to continue installation. The MySQL installation process will prompt for a password for the MySQL root user account. You can enter a password, or press "enter" to skip the password step - it is your choice. It is poor security to have a blank password if you will be running the MySQL Server on a shared network, but shouldn't matter if you are only using the system for development. The installation process will prompt you two additional times for a MySQL root password. Continue entering the same password (or skipping it) as you did at the first prompt. The MySQL Client is installed as part of the standard MySQL Server package from the Debian repository. You do not need to install additional software to start using MySQL.

Testing Your Installation

# Verify the MySQL Client was installed
mysql --version
# Connect to the MySQL Server on localhost
mysql --user=root --password=password

Installing MySQL Client From The Debian Repository

The MySQL Client is a "front end" to an existing database; it does not install the MySQL Server. The MySQL Client can be used to connect to MySQL Server databases across a network. It provides a text-based interface to a MySQL Server, and requires a basic understanding of standard SQL commands. (ie SELECT, UPDATE, INSERT, and DELETE).

Commands

# Install MySQL Client from the Debian repository
sudo apt-get install mysql-client

The package manager may suggest a slew of dependencies for MySQL Client. Press "Y" then "enter" (or just "enter") to continue installation.

Testing Your Installation

The following instructions make these assumptions:

  • You have an existing MySQL Server, whether on localhost or elsewhere across the network
  • The existing MySQL Server "listens for" (accepts) network connections (disabled on a default installation of MySQL Server)
  • The MySQL Server has either:
    • Allowed "root" login over a network connection (disabled on a default installation of MySQL Server), or
    • A MySQL user account for you

Testing Your Installation

# Verify the MySQL Client was installed
mysql --version
# Connect to a remote MySQL Server (assumes the server allows root access from a remote computer)
mysql --host=server_address --user=root --password=password
# Connect to a remote MySQL Server (assumes the server has already created your user account)
mysql --host=server_address --user=user_name --password=password