Project

General

Profile

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

Anchi Cheng, 01/06/2014 02:33 PM

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