27/MySQL

De MoodleDocs

Esta página necesita una revisión. Por favor, revísela y quite la plantilla {{Revisar}} cuando haya terminado.

Nota: Pendiente de Traducir. ¡Anímese a traducir esta página!.     ( y otras páginas pendientes)

Esta página está muy obsoleta respecto a la versión original en inglés

MySQL es una de las bases de datos que puede utilizar Moodle como base de su instalación.

MySQL se describe a sí misma como "el sistema más popular de gestión de bases de datos SQL de código abiero, desarrollado, distribuido y mantenido por MySQL AB. MySQL AB es una compañía comercial fundada por los desarrolladores de MySQL. Es una compañía de código abierto de segunda generación que conjuga los valores y metodología del código abierto con un exitoso modelo de negocio."

Installing MySQL

  • If you are running Linux your preference should be to install using your distributions package manager. This ensures you will get any available updates.
  • There are installers available for most popular operating systems at http://www.mysql.com/downloads/mysql/.
  • It is possible and reasonably straightforward to build mysql from source but it is not recommended (the pre-built binaries are supposedly better optimised).
  • Make sure you set a password for the 'root' user (see http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html).
  • Consider installing and configuring my.cnf (the MySQL settings file) to suit your needs. The default configuration is usually very conservative in respect of memory usage versus performance.

Creating Moodle database

These are the steps to create an empty Moodle database. Substitute your own database name, user name and password as appropriate.

The instructions assume that the web server and MySQL server are on the same machine. In this case the 'dbhost' is 'localhost'. If they are on different machines substitute the name of the web server for 'localhost' in the following instructions and the 'dbhost' setting will be the name of the database server.

Command line

  • Para crear una base de datos a través de la línea de comando. Antes de nada acceda al servicio MySQL de su servidor.
$ mysql -u root -p
Enter password: 

(Indique su password antes, o si ya lo está, al acceder como usuario 'root'). (Enter the password you previously set - or been given - for the MySQL 'root' user).

  • Crear una nueva base de datos (nombre 'moodle' - o el nombre que se precise. Recomendamos el uso de utf8_unicode_ci para la collation (tipo de codificación del texto de la base de datos)
mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  • Añadir usuario/password con los mínimos privilegios:
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'yourpassword';

... que crea un usuario 'moodleuser' con contraseña(password) 'yourpassword'. Asegúrese de que la contraseña sea lo suficientemente segura y resista la tentación de hacer al usuario 'GRANT ALL'.

phpMyAdmin

phpMyAdmin is a web based administration tool for MySQL. If this is available you can use it to create a new database. Make sure that you select 'UTF8' as the default character set.

Which database belongs to which Moodle

If you have installed several Moodle installations on the same server, there will be several several databases in your MySQL server. The names might be quite poor reflections of the content like _mdl1 _mdl2 _mdl3 . So how do I see which database goes with which Moodle installation? You can go in with phpMyAdmin and in the various databases check for the table "mdl_course". There you will easily see the name of that Moodle Installation. In table mdl_config you can see the Moodle version. (Where can one find the home relative URL of the Moodle installation?)


Véase también (páginas en inglés)