Tag Archive for freelance website developer

Simple steps to set Master / Slave replication in MySQL Database

Why i have to do master-slave replication using MySQL?

1. One of the biggest advantages to have master-slave set up in MySQL is to be able to use master for all of the inserts, update and delete queries and slave for select queries. This will most probably speed up your application without having to diving into optimizing all the queries or buying more hardware.

2. Do backups from slave: One of the advantages people overlook is that you can use MySQL slave to do backups from. That way site is not affected at all when doing backups.

Goal: Master DB – Use db only for insert,delete and updated queries
Slave DB – Use db only for select queries

There are several Master-Slave replication available in MySQL. Below is the one of the best Master-Slave replication.

Note:

1. Below configuration is only for a single database replication.
2. Do the step 1 and step 2 in your master server and step 3 and step 4 slave servers.
3. Before doing all steps, you must create database and repective tables in your master and slave server.

Step 1: (Activate binary(bin) log in MySQL)

vi /etc/my.cnf
===============
log-bin = mysql-bin
binlog-do-db = databasename // give your database name
server-id = 1 // unique id depend upon your servers

Step 2: (Creating a new user in Master)

In mysql… login as root user. Read more

Customizing the Read More link with WordPress

If you have set your WordPress site to display post excerpts on the front or home page, you will want visitors to click on the title or a link to encourage them to continue reading your post or article, right? WordPress makes this technique easy, and customizable.

Here is the steps:

  • Go to wordpress admin panel –> Design tab –> Theme Editor.
  • Select Main Index template (index.php) to edit it
  • Find the lineĀ  “<?php the_content(‘Read the rest of this entry &raquo;’); ?>”
  • And replace it with the following code.

<?php

$content = get_the_content($more_link_text, $stripteaser, $more_file);
if(strlen($content)>500) // chanage 500 as per your needs
{
$part_msg=substr($content, 0, 500);// chanage 500 as per your needs
echo ‘<p>’.$part_msg.’… ‘;
?>
<br /><br />
<a href=”<? comments_link(); ?>”>Read More…</a></div>
<?php
echo ‘</p>’;
}
else
{
echo ‘<p>’.$content.’</p></div>’;
}

?>

Where “500″ represents number of characters that you want to show.

If you cannot able to make the above changes with the wordpress theme editor, use your ftp.

Here is the template directory

/public_html/blog/wp-content/themes

or

/www/blog/wp-content/themes

where blog is the directory where i installed my wordpress