FR:RPi MySQL

From eLinux.org
Revision as of 11:58, 26 May 2013 by Xavier (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installation de MySQL sur Raspberry Pi

Ceci est un guide pour installer MySQL Community Edition (aka "MySQL") sur l'ordinateur Raspberry Pi sous Debian "squeeze".

MySQL est constitué de deux composants distincts :

  • 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.

Installation de MySQL Server à partir du dépôt Debian

Commandes

# 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.

Test de votre installation

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

Installation de MySQL Client à partir du dépôt Debian

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).

Commandes

# 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.

Test de votre 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

Test de votre 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