Project

General

Profile

Database Server Setup to allow connection from the instruments » History » Version 11

Anchi Cheng, 07/23/2014 02:19 AM

1 9 Anchi Cheng
h1. Setup to allow connection from the instruments
2 1 Anchi Cheng
3 9 Anchi Cheng
h2. Allow remote access to database server (default in CentOS 6).
4 2 Anchi Cheng
5
h3. Edit /etc/my.cnf search for *skip-networking* and make sure it is commented out like this:
6
7
<pre>
8
#skip-networking
9 1 Anchi Cheng
</pre>
10 7 Anchi Cheng
11
Also look for bind-address in the same file and if it says 127.0.0.1, it will only listen to local connection.
12
You should comment that out as well.
13 3 Anchi Cheng
<pre>
14 7 Anchi Cheng
#bind-address=127.0.0.1
15 5 Anchi Cheng
</pre>
16 2 Anchi Cheng
17 7 Anchi Cheng
h3. Restart mysqld if you have made changes.
18 2 Anchi Cheng
19
For CentOS, Fedora
20
<pre>
21
sudo /etc/init.d/mysqld restart
22
</pre>
23
or
24
<pre>
25
sudo /sbin/service mysqld restart
26 1 Anchi Cheng
</pre>
27
28 8 Anchi Cheng
h2. Create remote user if autoinstaller was used
29 2 Anchi Cheng
30 9 Anchi Cheng
Autoinstaller creates only root user and only allow its access to database from the localhost.
31 1 Anchi Cheng
32 8 Anchi Cheng
The following assumes that you want to use usr_object user for remote access as referenced in most of this document.
33
34
h3. Create and grant privileges to the usr_object for the databases on the hosts involved.  See MySQL Reference Manual for details.
35
36 1 Anchi Cheng
You can set hosts on a particular subnet by only specify the network number portion such as '192.168' and use wild card for the host number portion to give '192.168.%.%' as the global host allowing connection.
37 2 Anchi Cheng
If appropriate, you can also use domain name with wild care i.e., '%.mydomain.edu'
38
39
At the mysql prompt execute the following commands:
40
<pre>
41 9 Anchi Cheng
CREATE USER usr_object@'192.168.%.%' IDENTIFIED BY 'YOUR_PASSWORD';
42 2 Anchi Cheng
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'192.168.%.%';
43 1 Anchi Cheng
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'192.168.%.%';
44
</pre>
45
46
<pre>
47 9 Anchi Cheng
CREATE USER usr_object@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
48 1 Anchi Cheng
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'localhost';
49
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'localhost';
50
</pre>
51 8 Anchi Cheng
52 11 Anchi Cheng
<pre>
53
flush privileges;
54
exit;
55
</pre>
56
57 10 Anchi Cheng
h3. Other changes if usr_object will be used all the time from now on in autoinstalled Leginon:
58 8 Anchi Cheng
59 1 Anchi Cheng
*webserver* myamiweb/config.php
60 8 Anchi Cheng
<pre>
61
define('DB_USER', 'usr_object');
62 9 Anchi Cheng
defube('DB_USER','YOUR_PASSWORD');
63 8 Anchi Cheng
</pre> 
64
65 9 Anchi Cheng
*processing server* /etc/myami/sinedon.cfg or ,if it does not exist, see [[Configure_sinedoncfg]] for other possibilities
66 8 Anchi Cheng
<pre>
67
user: usr_object
68 9 Anchi Cheng
passwd: YOUR_PASSWORD
69 2 Anchi Cheng
</pre>
70
71
______
72
73
[[Web Server Installation|< Web Server Installation]] | [[Additional Database Server Setup after Web Server Installation| Additional Database Server Setup >]] 
74
75
76 1 Anchi Cheng
______