Project

General

Profile

Setup Local Databases » History » Version 6

Amber Herold, 02/12/2010 10:38 AM

1 1 Amber Herold
h1. Setup Local Databases 
2
3
{{>toc}}
4
5
h2. 1 Make sure MySQL is installed
6
7
Follow the instructions in the "Leginon install guide":http://emg.nysbc.org/documentation/leginon/bk02ch04s07.php.
8
 
9
Also install phpMyAdmin found under "Other Tools" on "this page":http://emg.nysbc.org/documentation/leginon/bk02ch04s08.php.
10
Note that phpMyAdmin version 2.11.10 works with older versions of PHP (that we happen to use).
11
12
h2. 2 Dump tables from cronus4 to a local file
13
14
This will grab the actual data that we use so you can play with it.
15
Log into cronus3 so that you can access cronus4.
16
17
<pre>
18
$ ssh cronus3
19
</pre>
20
21
Use mysqldump to get any table data that you want as in the example below. 
22
Cronus4 is the host. 
23
We do not lock the tables because we don't have permission to. 
24
"project" is the name of the database and "login" is the name of the Table.
25
We make up a file name for the data to dump to.
26
27
<pre>
28 3 Neil Voss
$ mysqldump -h cronus4 -u usr_object --skip-lock-tables --extended-insert project login > ProjectLogin.sql
29 1 Amber Herold
</pre>
30 3 Neil Voss
31
The @--extended-insert@ option causes mysqldump to generate multi-value INSERT commands inside the backup text file which results in the file being smaller and the restore running faster. "ref":http://www.mythtv.org/wiki/Backup_your_database
32 1 Amber Herold
33 2 Amber Herold
More info on mysqldump is "here":http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_tables.
34
35 1 Amber Herold
Exit cronus3 when you are done dumping tables and load the dump files into your database.
36
If you followed the instructions for setting up MySQL in the Leginon Install guide, you have already created dbemdata and projectdata databases.
37
If you don't have them, create them first.
38
39
<pre>
40
mysql -u root projectdata < ProjectLogin.sql
41
</pre>
42
43
h2. 3 Modify Config.php
44
45 6 Amber Herold
This is the Myami config file. It is being changed right now so this is in flux. Will update soon.
46
47 1 Amber Herold
It should look like this:
48
49
<pre>
50
// --- Set your leginon MySQL database server parameters
51
52
$DB_HOST        = "localhost";
53
$DB_USER        = "usr_object";
54
$DB_PASS        = "";
55
$DB             = "dbemdata";
56
57
// --- XML test dataset
58
$XML_DATA = "test/viewerdata.xml";
59
60
// --- Project database URL
61
62
$PROJECT_URL = "project";
63
$PROJECT_DB_HOST = "localhost";
64
$PROJECT_DB_USER = "usr_object";
65
$PROJECT_DB_PASS = "";
66
$PROJECT_DB = "projectdata";
67
</pre>
68
69
h2. 4 Populate your databases automagically
70
71
Point your web browser to http://localhost/myamiweb/.
72
Navigate to the Administration page and then to the ProjectDB page. 
73
74
Doing this will populate your database with the schema defined in myami/myamiweb/project/defaultprojecttables.xml.
75 5 Amber Herold
If you need to repopulate tables, use phpMyadmin to empty the Install table in the project DB. Then repeat the steps above.