Project

General

Profile

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

Anchi Cheng, 07/24/2014 07:01 PM

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 12 Anchi Cheng
Start mysql command line interface in a terminal as root and access the database named mysql which manages users and permission. We assume that you have used autoinstaller here and hence the password for root using in mysql is not yet set.
40
41
<pre>
42
mysql mysql
43
</pre>
44
45 2 Anchi Cheng
At the mysql prompt execute the following commands:
46
<pre>
47 9 Anchi Cheng
CREATE USER usr_object@'192.168.%.%' IDENTIFIED BY 'YOUR_PASSWORD';
48 2 Anchi Cheng
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'192.168.%.%';
49 1 Anchi Cheng
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'192.168.%.%';
50
</pre>
51
52
<pre>
53 9 Anchi Cheng
CREATE USER usr_object@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
54 1 Anchi Cheng
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'localhost';
55
GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'localhost';
56
</pre>
57 8 Anchi Cheng
58 11 Anchi Cheng
<pre>
59
flush privileges;
60
exit;
61
</pre>
62
63 10 Anchi Cheng
h3. Other changes if usr_object will be used all the time from now on in autoinstalled Leginon:
64 8 Anchi Cheng
65 1 Anchi Cheng
*webserver* myamiweb/config.php
66 8 Anchi Cheng
<pre>
67
define('DB_USER', 'usr_object');
68 13 Anchi Cheng
define('DB_USER','YOUR_PASSWORD');
69 8 Anchi Cheng
</pre> 
70
71 9 Anchi Cheng
*processing server* /etc/myami/sinedon.cfg or ,if it does not exist, see [[Configure_sinedoncfg]] for other possibilities
72 8 Anchi Cheng
<pre>
73
user: usr_object
74 9 Anchi Cheng
passwd: YOUR_PASSWORD
75 2 Anchi Cheng
</pre>
76
77
______
78
79
[[Web Server Installation|< Web Server Installation]] | [[Additional Database Server Setup after Web Server Installation| Additional Database Server Setup >]] 
80
81
82 1 Anchi Cheng
______