Setup Local Databases » History » Version 1
Amber Herold, 01/29/2010 05:38 PM
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 | $ mysqldump -h cronus4 -u usr_object --skip-lock-tables project login > ProjectLogin.sql |
||
29 | </pre> |
||
30 | |||
31 | Exit cronus3 when you are done dumping tables and load the dump files into your database. |
||
32 | If you followed the instructions for setting up MySQL in the Leginon Install guide, you have already created dbemdata and projectdata databases. |
||
33 | If you don't have them, create them first. |
||
34 | |||
35 | <pre> |
||
36 | mysql -u root projectdata < ProjectLogin.sql |
||
37 | </pre> |
||
38 | |||
39 | h2. 3 Modify Config.php |
||
40 | |||
41 | It should look like this: |
||
42 | |||
43 | <pre> |
||
44 | // --- Set your leginon MySQL database server parameters |
||
45 | |||
46 | $DB_HOST = "localhost"; |
||
47 | $DB_USER = "usr_object"; |
||
48 | $DB_PASS = ""; |
||
49 | $DB = "dbemdata"; |
||
50 | |||
51 | // --- XML test dataset |
||
52 | $XML_DATA = "test/viewerdata.xml"; |
||
53 | |||
54 | // --- Project database URL |
||
55 | |||
56 | $PROJECT_URL = "project"; |
||
57 | $PROJECT_DB_HOST = "localhost"; |
||
58 | $PROJECT_DB_USER = "usr_object"; |
||
59 | $PROJECT_DB_PASS = ""; |
||
60 | $PROJECT_DB = "projectdata"; |
||
61 | </pre> |
||
62 | |||
63 | h2. 4 Populate your databases automagically |
||
64 | |||
65 | Point your web browser to http://localhost/myamiweb/. |
||
66 | Navigate to the Administration page and then to the ProjectDB page. |
||
67 | |||
68 | Doing this will populate your database with the schema defined in myami/myamiweb/project/defaultprojecttables.xml. |