test
[hcoop/zz_old/ikiwiki] / MemberManual / Databases.mdwn
CommitLineData
ee25310d 1#pragma section-numbers off\r
2\r
3This is the chapter of the MemberManual that describes how to use PostgreSQL and MySQL databases on HCoop servers.\r
4\r
5[[TableOfContents]]\r
6\r
7= MySQL =\r
8\r
9== Create an Account ==\r
10Creating a MySQL user account is an easy task with {{{dbtool}}}. It is available for use when you login to mire.hcoop.net. \r
11\r
12Run the following command:\r
13\r
14{{{\r
15dbtool mysql adduser\r
16}}}\r
17\r
18You will be asked for a password. The user created will be the same as your log-in username.\r
19\r
20== Create a Database ==\r
21{{{dbtool}}} is also used to create new MySQL databases. Replace DATABASE with your desired database name:\r
22\r
23{{{\r
24dbtool mysql createdb DATABASE\r
25}}}\r
26\r
27The database created will be USER_DATABASE (where USER is your username and DATABASE is the name you provided {{{dbtool}}}).\r
28\r
29== Delete a Database ==\r
30Delete a database with the following:\r
31\r
32{{{\r
33dbtool mysql dropdb DATABASE\r
34}}}\r
35\r
36== Changing Your Password ==\r
37If you need to change your MySQL password for security purposes or you have forgotten it, you may do so with this command:\r
38\r
39{{{\r
40dbtool mysql passwd\r
41}}}\r
42\r
43You will be prompted to input a new password.\r
44\r
45== Accessing Databases ==\r
46For web applications, set the MySQL host/server to {{{mysql}}}. Default ports apply. Use your HCoop username. Your password will be required. Please safeguard it. Remember that your database is really named USER_DATABASE, where DATABASE is the name you originally gave {{{dbtool}}}. Follow your software package's instructions.\r
47\r
48In addition, you can easily use the {{{mysql}}} shell to manipulate or analyze your databases:\r
49\r
50{{{\r
51mysql -p -h mysql USER_DATABASE\r
52}}}\r
53\r
54For security reasons, you cannot drop a database using the {{{mysql}}} shell.\r
55\r
56To learn more about the MySQL shell, review the [http://dev.mysql.com/doc/refman/5.0/en/ MySQL manual].\r
57\r
58\r
59= PostgreSQL =\r
60\r
61== Create an Account ==\r
62To create a PostgreSQL user account, enter the following command on mire.hcoop.net:\r
63\r
64{{{dbtool postgres adduser}}}\r
65\r
66You will not be prompted for a password since PostgreSQL utilizes a security model that is quite different from MySQL. The user created will be the same as your log-in username.\r
67\r
68== Create a Database ==\r
69Additionally, {{{dbtool}}} is used to create new Postgres databases. Replace DATABASE with your desired database name:\r
70\r
71{{{\r
72dbtool postgres createdb DATABASE\r
73}}}\r
74\r
75The database created will be called USER_DATABASE (where USER is your username and DATABASE is the name you provided {{{dbtool}}}).\r
76\r
77== Delete a Database ==\r
78Delete a database with the following command:\r
79\r
80{{{\r
81dbtool postgres dropdb DATABASE\r
82}}}\r
83\r
84For security reasons, you cannot drop a database using the {{{psql}}} shell.\r
85\r
86== Accessing Databases ==\r
87For web applications, set the PostgreSQL host/server to {{{postgres}}}. Default ports apply. Use your HCoop username. A password is not required. Remember that your database is really named USER_DATABASE, where DATABASE is the name you originally gave {{{dbtool}}}. Follow your software package's instructions.\r
88\r
89It is very easy to access your database using a PostgreSQL shell:\r
90\r
91{{{\r
92psql -h postgres USER_DATABASE\r
93}}}\r
94\r
95To learn more about the {{{psql}}} shell, take a look at the [http://www.postgresql.org/docs/8.1/interactive/index.html PostgreSQL manual].\r