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