Menu

Project Database

Project MySQL service

SourceForge.net provides MySQL database services on an opt-in basis.

These database services may be used for a variety of things, including:

  • Data storage for dynamic project websites.
  • Data storage for demos of the project's software residing in project web space.
  • In support of project software testing and development needs.
  • Data storage for applications deployed by the project to Project web.

We encourage developers new to MySQL to familiarize themselves with the MySQL manual. Since the database servers are shared among many projects, appropriate application performance tuning should be performed by the project to avoid impacting other projects.

Features

Service is based on MariaDB 10.6 on the x86_64 architecture and supports standard features, with the following caveats:

  • We discourage the use of pconnect due to the way we distribute load among our server pool. Please use standard connects.
  • We discourage the use of INSERT DELAYED due to server load risks.
  • Query runtime is capped at 120 seconds. Queries that exceed the cap will be killed.
  • Project databases are accessible from the project web servers.
  • Project databases are accessible from the interactive shell servers. The command-line MySQL client is installed on the shell servers.
  • A centralized install of phpMyAdmin is provided to ease database management.
  • Three database users are provided for each database, one for each access level: admin, read/write, and read-only.
  • Projects may create multiple databases (under the namespace provided to the project) using the project's database admin account.
  • Service usage is not restricted by quotas.

Access

Project teams can access the database using the "MySQL Database" link in the left sidebar of the project's Admin page.
You can also find the hostname, username and password for the database

MySQL host

MySQL service is split into database servers based on the first letter of the project's UNIX name. This will be denoted as LETTER in the following documentation.

The hostname for our MySQL server is mysql-LETTER

For example, if the project's UNIX name is "leaf", the LETTER value for this project would be "l".
The MySQL database server for the leaf project is mysql-l.sourceforge.net.

NOTE: If you are connecting from the project web space or shell service the trailing .sourceforge.net should not be used.

Access interface

phpMyAdmin is provided as an easy-to-use web-based interface to your MySQL database.

Project MySQL databases may also be accessed from Project web and via the Shell service

Example connection with php

<?php
function OpenConn()
{
    $dbhost = "Hostname";
    $dbuser = "User";
    $dbpass = "Password";
    $db = "DatabaseName";
    $conn = new mysqli($dbhost, $dbuser, $dbpass,$db) or die("Connect failed: %s\n". $conn -> error);

    return $conn;
}

function CloseConn($conn)
{
    $conn -> close();
}
?>

Example connection with Shell service

mysql -h HostName -u UserName -p

Database naming

To ensure the database namespace is unique for each project, databases created by a project all use a project-specific prefix. This prefix uses a combination of the LETTER and the group ID for the project, in the form {LETTER}{GROUP ID}_* Multiple databases may be created by a project.

Continuing our example: Since the "leaf" project's group ID is 13751, their database names would be prefixed by: l13751_ The leaf project can create multiple databases as needed, such as l13751_cmsdata and l13751_apptest.

The admin user is used to create new databases for your project.

Authentication

Each project is provided three database users, each with a specific level of permissions.

User: Permissions
{LETTER}{GROUP ID}ro Read-only (SELECT)
{LETTER}{GROUP ID}rw Read/write (Above plus INSERT, DELETE, UPDATE)
{LETTER}{GROUP ID}admin Read/write (Above plus administrative capabilities)
Continuing our example, the "leaf" project's three users are: l13751ro, l13751rw, and l13751admin.

Passwords are set individually for these accounts from the project database administration page. Before an account can be used, an initial password must be set by the project administrator.

Management

To activate MySQL service for your project, a password must be configured for one or more of the database users issued to your project. Your MySQL-dependent applications should be made to use the read-only or read/write MySQL user as appropriate for the application. The admin user should be used by a human user (as opposed to your application) to manage the database, but should not be used by an application due to security risks.

The admin user is needed to create databases. To create a database, you may do one of:

Connect to phpMyAdmin as your project's database admin user and use the web interface to create a database.
From the interactive shell server, use the command-line MySQL client ('mysql') to connect to the MySQL server as your project's database admin user and issue a CREATE DATABASE.

Backups

SourceForge.net performs routine backups for all of our servers and will restore from these backups in the event of catastrophic server failure. We encourage projects to make their own backups of their MySQL data as that data restore can be performed by the project in the event of accidental data destruction by a member of the project team or exploit of their database via project web.

Backups may be performed using our shell service, or phpMyAdmin. See [MySQL Backups] for instructions.


Related

Documentation: MySQL Backups
Documentation: Project Web Services
Documentation: Project Web and Developer Web
Documentation: Shell Service