Project

General

Profile

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

Anchi Cheng, 01/06/2014 01:59 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
h2. Bind mysqld to its IP address to allow tcp connection to it.
6
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
</pre>
12
Add the address the database is bound to after that line
13
<pre>
14
#skip-networking
15
bind-address=your.ip.address.number
16
</pre>
17 3 Anchi Cheng
for example, 192.168.0.1 in a local network
18 2 Anchi Cheng
19 5 Anchi Cheng
20 2 Anchi Cheng
h3. Restart mysqld
21 4 Anchi Cheng
22 2 Anchi Cheng
For CentOS, Fedora
23
<pre>
24
sudo /etc/init.d/mysqld restart
25
</pre>
26
or
27
<pre>
28
sudo /sbin/service mysqld restart
29
</pre>
30 1 Anchi Cheng
31 4 Anchi Cheng
h3. Create remote user
32 2 Anchi Cheng
33
Create and grant privileges to the usr_object for the databases on the hosts involved.  See MySQL Reference Manual for details.
34
35
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.
36
If appropriate, you can also use domaian name with wild care i.e., '%.mydomain.edu'
37
38
At the mysql prompt execute the following commands:
39
<pre>
40
CREATE USER usr_object@'192.168.%.%' IDENTIFIED BY 'YOUR PASSWORD';
41
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'192.168.%.%';
42
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'192.168.%.%';
43
</pre>
44
45
h3. Change localhost database user to usr_object if autoinstaller was used.
46
47
Autoinstaller does not create usr_object user on the localhost but use root user for database connection.   You may want to make change at this time.
48
49
At the mysql prompt execute the following commands:
50
<pre>
51
CREATE USER usr_object@'localhost' IDENTIFIED BY 'YOUR PASSWORD';
52
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'localhost';
53
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'localhost';
54
</pre>
55
56
______
57
58
[[Web Server Installation|< Web Server Installation]] | [[Additional Database Server Setup after Web Server Installation| Additional Database Server Setup >]] 
59
60
61
______