How To Make Money With Your Blogs!

BlogForumManagerReportsVideosPluginsDownloadsHelp

An Important (And Often Ignored) Thing You SHOULD Do During WordPress Setup

by David Pankhurst - April 21, 2008

In the process of transferring some older blogs over to another site (preparation for an ActiveBlogging Report article), I was reminded of a little trick I learned about setup - but unfortunately AFTER I set these particular blogs up!

The trick is simple: as discussed in my post on mySQL, the WordPress setup involves four pieces of data - a DATABASE, a USER with PASSWORD, and a HOST (usually localhost).

But the wp-config.php file includes another entry - and this brings us to the topic of TABLES.

In the mySQL database, the data is further split into tables. In WordPress, there are multiple tables, for example containing comments, the posts, user information, etc - and the whole package in the database is the complete mySQL data for a blog.

If you’ve ever explored your database (for example, using cPanel’s phpMyAdmin), you’ll recognize the tables in the database right off - by default, they will all start with ‘wp_’, like wp_posts, wp_comments, etc. This labeling system makes it easy to group together the tables in a database.

And here’s where the entry from wp-config.php comes in handy:

$table_prefix  = 'wp_';

As you see, it defaults to wp_ - but it can be something else if you want.

Why?

The advantage is that if you rename it, THAT set of WordPress tables will have a different prefix, which means you can then add yet another blog to the database, calling it with a different prefix.

For example, if I set up one blog for dogs, I could change wp_ to dogs_; now my tables would be dogs_posts, dogs_comments, etc. For insurance, I could change from wp_ to insurance_ (although I’d likely shorten it to insur_ or even ins_) and so on.

I try to keep them to 2-5 letters long, with the underscore at the end, and descriptive of the blog’s content. You can also use numbers.

Since there can only be one table of a specific name in a mySQL database, renaming them is the only way to pack more in, and so now different blogs can share the same database, yet keep their tables separate.

And this has a real advantage on some sites, where you have a limited amount of databases. But it’s a handy practice to follow even if that’s not a concern.

In fact, I recommend you ALWAYS set up your database tables this way. The result is that if you ever move a blog, you have the option of keeping it in a separate database, or putting it in with other blogs. This flexibility means less database management in the long run.

It’s a small detail, but as your blogs age and possibly get moved from place to place, you will find yourself glad you did it. I know in my case, I wish I had known this earlier on!


ActiveBlogging.com - for information on making your blog successful! Get information like this - and more - inside! Details here or Join Today!

Leave a Reply