Pages

Welcome to My Blog

This is to share my IT experience with friends all around the world.
I have been working in Linux Fedora Systems for more than 8 years. Its fun to share knowledge and learn..
As everyone knows when a problem arises in your systems "googling" is the way that many depend on..

All the posts here are my working experiences during my working life.. So you can count on it..

I have added the references where I got help in solving IT issues


Thursday, May 21, 2015

Upgrade PHP 5.3 to 5.4 in CentOS

I wanted to upgrade php version of one of the server. After referring the following web page it was easily done without any issue.

http://www.servermom.org/upgrade-php-53-54-55-centos/1534/

Monday, April 6, 2015

MySQL Sync with one Master and 2 Slaves

We had a requirement to run mysql replication with one master and 2 slaves. By following normal procedure this is doable. Interestingly we got few points which may be useful to others when working with mysql replication. Following given the points that we had to deal with;

1. A slave with mysql higher version: One slave had mysql ver 5.5 while others are with mysql 5.1. In this case the mysql server 5.5 does not allow to configure mysql masters details in my.cnf where we need to give some important parameters of master server. Following blog page describes the way to give those parameters in the shell and configure the server to connect with the master server.

https://tapasmishra.wordpress.com/2012/06/11/how-to-configure-mysql-5-5-server-as-replication-slave/

Following setting was taken from the above post
mysql> CHANGE MASTER TO MASTER_HOST=’192.168.2.101′,
MASTER_PORT=3306,
MASTER_USER=’replication_user’,
MASTER_PASSWORD=’PASSWORD';
 2. After configuring the master parameters in the slave server as above, we encountered an interesting issue in the synchronization. The issue was identified referring /var/log/mysqld.log and also from 'show slave status' in the shell. The issue was the slave replication SQL thread aborted due to non executable sql commands in master log. Referring below post;

http://stackoverflow.com/questions/2366018/how-to-re-sync-the-mysql-db-if-master-and-slave-have-different-database-incase-o

According to the above post, when defining the master parameters, we need to give MASTER_LOG_FILE and MASTER_LOG_POS. These parameters can be observed by executing 'show master status' in the master server. After getting the log file name and the log position of the master server, the database in the master file should be copied to the slave server. Please note that it is very important to keep the same data in the databases in both master and slave servers when defining the master log positions. mysqldump command can be used to copy the master server's database to slave server.

We gave the master_log_file and master_log_pos parameters along with the master_host, master_port parameters with the CHANGE MASTER TO .. command.

After rectifying the above described issues, the replications were started correctly.

Thursday, October 9, 2014

Limiting a User to Read few columns on a table in MySQL Database

I wanted to limit a mysql user to read only few fields of a table in a MySQL database. I used select grant privileges command to get the desired output.

For example if a user 'test_user' is requested to access field1, field3 and field6 on the test_table in test_db at 192.168.1.1 server following user creation will work.

The user has to be added at the mysql server running on 192.168.1.1. I have assumed the user test_user is connecting from 192.168.1.2

mysql> GRANT SELECT (`field1` ,`field3`, `field6`)  ON `test_db`.`test_table` TO 'test_user'@'192.168.1.2' identified by 'test_pw';


If you want to allow the user to modify the data in the table you may use 'UPDATE' privilege instead of 'SELECT' privilege.

References