Recent Changes

2021-07-26
2021-03-17
2021-03-08
2021-03-03
2021-01-22
2021-01-21

How to Use MySQL Database

On OSDN, we provide RDBMS that every project can use. Database can only be accessed from within the OSDN network such as project web and shell servers. The type of database is MySQL. There are several configurations required, so read this document carefully before using.

What is MySQL

MySQL is an open source RDBM which can be accessed with many different programming languages. Languages that are supported on OSDN, such as Ruby, Perl, PHP, and Python, are available for accessing. You can find MySQL information on MySQL website with MySQL Reference Manual which is very elaborate to details. http://www.mysql.gr.jp/ has MySQL information provided in Japanese with reference manual translated to Japanese. There is also a wide range of related works introduced, so you may want to take a look at them for reference.

How to Create a Project Database

The creation process of MySQL database for project is automated here on OSDN. Project admin is required to give directions such as creating database and making changes on database, from the project admin page, .

A project database is created by the project admin of that project. From the project menu on project home page, Choose “Admin”, then “database manager”. Create a database and database user accordingly to the instructions given on this admin page, then assign a password. The database becomes accessible after this process. The process of creating a database isn't something that gets executed right away. The requests to create a database and to change password are put in the queue. The items in the queue get processed after a while. After they are processed, the database gets in a status of being accessible, then the “status” of the database admin page becomes “active”.

How to Change the Password of MySQL Database User

You can change the password of a MySQL database user. To make that change, go to the project page and choose “Admin” from the project menu, then select “Database Manager”. Enter the new password into the “New Password” and “ReType Password” filed, then click on the “Update” button.

The process of changing password for a database is not going to be executed right away just like how it is with creating a database. The request to create a database and to change password are put in the queue. The items in the queue get processed after a while.

How to Access MySQL Database

When accessing the project's database, you will be asked for basic information as shown below.

  • Database host: mysql5.osdn.jp
  • Name of the database: Same as the project's UNIX name (but without the hyphen)
  • Name of the database user: Same as the project's UNIX name (but without the hyphen)
  • Database password: Assigned by the project admin.

If there's a “-” in the project name, the name of the database / name of the database's user will have to be something having the “-” eliminated. The reason is because MySQL does not allow names with “-”. There's a possibility that it could overlap with other project. In that case, you'll be assigned with a name that doesn't. You can see what database name your project is given by checking on project's “change history display”.

How to Access Database from Shell Server

Project's database can be interactively accessed from shell server. Let's try by typing the following string on shell server.

% mysql -u '''projectdbuser''' --database='''projectdbname''' --host=mysql5.osdn.jp -p

In place of projectdbuser and projectdbname, enter your project's information accordingly as instructed above. Once you're done entering them, you'll be asked for the password. If the configurations were done properly, the MySQL prompt window will pop up, and from there you can manipulate the database in an interactive fashion.