Database Server Setup to allow connection from the instruments » History » Revision 13
Revision 12 (Anchi Cheng, 07/23/2014 03:24 PM) → Revision 13/16 (Anchi Cheng, 07/24/2014 07:01 PM)
h1. Setup to allow connection from the instruments h2. Allow remote access to database server (default in CentOS 6). h3. Edit /etc/my.cnf search for *skip-networking* and make sure it is commented out like this: <pre> #skip-networking </pre> Also look for bind-address in the same file and if it says 127.0.0.1, it will only listen to local connection. You should comment that out as well. <pre> #bind-address=127.0.0.1 </pre> h3. Restart mysqld if you have made changes. For CentOS, Fedora <pre> sudo /etc/init.d/mysqld restart </pre> or <pre> sudo /sbin/service mysqld restart </pre> h2. Create remote user if autoinstaller was used Autoinstaller creates only root user and only allow its access to database from the localhost. The following assumes that you want to use usr_object user for remote access as referenced in most of this document. h3. Create and grant privileges to the usr_object for the databases on the hosts involved. See MySQL Reference Manual for details. 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. If appropriate, you can also use domain name with wild care i.e., '%.mydomain.edu' 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. <pre> mysql mysql </pre> At the mysql prompt execute the following commands: <pre> CREATE USER usr_object@'192.168.%.%' IDENTIFIED BY 'YOUR_PASSWORD'; GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'192.168.%.%'; GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'192.168.%.%'; </pre> <pre> CREATE USER usr_object@'localhost' IDENTIFIED BY 'YOUR_PASSWORD'; GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON leginondb.* TO usr_object@'localhost'; GRANT ALTER, CREATE, INSERT, SELECT, UPDATE ON projectdb.* TO usr_object@'localhost'; </pre> <pre> flush privileges; exit; </pre> h3. Other changes if usr_object will be used all the time from now on in autoinstalled Leginon: *webserver* myamiweb/config.php <pre> define('DB_USER', 'usr_object'); define('DB_USER','YOUR_PASSWORD'); defube('DB_USER','YOUR_PASSWORD'); </pre> *processing server* /etc/myami/sinedon.cfg or ,if it does not exist, see [[Configure_sinedoncfg]] for other possibilities <pre> user: usr_object passwd: YOUR_PASSWORD </pre> ______ [[Web Server Installation|< Web Server Installation]] | [[Additional Database Server Setup after Web Server Installation| Additional Database Server Setup >]] ______