All About Web Hosting

A repository for all kinds of useful web hosting information

Archive for the ‘Uncategorized’ Category

Using mysqldump to backup MySQL database from the command line

without comments

I suspect that most people who work with MySQL database use PHPMyAdmin to interact with their database, and so may not know about how handy the command line program mysqldump is both for one-time backups and for regular use.

I believe that mysqldump comes with the regular installation of mysqldump (at least on linux servers) so it should be available, assuming you have command line access to it, etc.

Using mysqldump is pretty straightforward – the basic command is:
mysqldump [database name]

Which will output the SQL to recreate that database. Obviously, watching all that code stream by on the console is not terribly useful, so we need to dump it to a backup file – for example:
mysqldump [datbase name]  > [backup filename]

The “>” directs that output to the file.
The most common complication of this is the need to send passwords, usernames, etc. That’s easy enough as well. This command adds username, password and host:
mysqldump –user [username] –password –host [host name/IP] [database name] > [backup filename]
When run, mysqldump will ask for the password before proceeding.

If you only need a backup for one table, you can just add the table’s name after the database name in the command, and mysqldump will only dump the SQL for that table.

Then, if you need to recover a database from a dump, it’s pretty easy as well:
mysql [database name] < [backup filename]

You may need to add –user, etc to that command (as with the mysqldump example) to connect.

Hope that’s helpful to someone!

Written by web hosting guy

December 2, 2008 at 7:17 pm

Posted in Uncategorized

Tagged with , , ,

Free Web Hosting – I don’t get it

without comments

You occasionally see offers for free web hosting, or people trying to find a decent free web host. I’ve never understood the point of free hosting. It boils down to this – why would you spend the time to find a free host, put up with whatever rigamarole they’re going to put you through for the free server, and then spend time building a site on that free host – if you’re going to do all this, why wouldn’t you take the step of just getting some cheap web hosting. Surely your time is worth more than the few bucks a month you save by using free hosting? To say nothing of the fact that such hosts are often insecure, unstable and unpredictable.

Seriously, if you’re thinking about this, think about why. If you’re unwilling to spend a few bucks a month to get actual hosting for your site, why are you spending time on it in the first place?

Written by web hosting guy

November 25, 2008 at 5:15 pm

Posted in Uncategorized

Handy VI tip – using buffers and macros

without comments

I do nearly all my coding in vim – other than the occasional use of textpad when I don’t have ssh access to a website… I like vim because I prefer working on the server – everything’s there, and there’s no time wasted uploading/download, etc. And you can also use things like grep to help you get things done.

Two of the handiest features in vim are buffers and macros. (Are there such thing as freudian typos? I keep mis-typing “buffers” as “buggers”… lol). Buffers allow you to quickly pull text into a little spot in memory – it’s like the clipboard that every (modern) OS has, except that you have a lot of them available. Basically you assign a letter (or number I think) to the buffer, and copy/paste using that. This vim buffer example has more info.

Macros are even handier, in my opinion – especially when used in conjunction with buffers. Basically, they record all your key strokes, and since vim is a console program, that means a macro records everything. With some clever use of searching, etc you can use a macro to automate just about any repetitive task you can imagine.  Here’s some great vim macro examples.

Written by web hosting guy

October 3, 2008 at 3:09 pm

Posted in Uncategorized

Tagged with ,

A couple handy command line (SSH) tips

without comments

Just a quick bit that may be helpful to someone out there… If you have a linux-based web hosting plan and SSH access, you have a very powerful tool at your command! We’re talking many times more useful than simple FTP.

For example, say you need to update your site, but you’re not sure which files have the bit of text you need. Let’s say it’s an out of date copyright line in a footer – try this:

grep -rl ‘copy 2007” *

Which will list all files that have that “copy 2007″ text in them, in all directories from the current one on down. Or perhaps you need to securely copy a lot of files from one website to another. Of course you could downlod them all from site1 to your local machine, then upload them all to site2… But isn’t that kind of a waste when you could directly from site1 to site2? Heck, the internet connections between the two servers are probably faster than your local connection also. Try using scp to copy files. This command will recurisvely (i.e. get all the subdirectories) copy from site1 to site2:

scp -r ./* site@site.com:~/site2/path/to/desination/

It’s as easy as that! Don’t let the fact that these commands seem arcane or complicated, there’s tons of other examples out there on the web – just do some googling!

Written by web hosting guy

September 30, 2008 at 5:41 pm

Posted in Uncategorized

Tagged with

Business card sized web server?

without comments

Saw this linked from Slashdot – how to make a card-sized web server – pretty cool! Not sure what you’d do with it, and it makes you wonder how much traffic it could handle… And how it would scale – would a large number of these actually be more power/cost/space efficient than a “normal” web server?
And of course, you’d need somewhere to put them… If you’re in the market for colocation space in the Midwest, EliteRAX has great rates on Michigan colocation services in their Detroit-area data center.

Written by web hosting guy

September 26, 2008 at 3:34 pm

Posted in Uncategorized

Tagged with ,

The Importance of the Data Center

without comments

It’s hard to overstate the importance of the data center when it comes to web hosting. After all, it’s the foundation that any web hosting services offered by a company are based on. It is a major piece of the whatever uptime the data center can provide, as well as a big piece of the overall security of any equipment used by a web hosting business.

A good data center requires a number of elements:

  • Redundant power, with a UPS (Uninterruptible Power Supply) to provide power until the generator comes online – after all, the hardware is useless with out power!
  • Redundant high speed network connections – with the ability to reroute traffic in case of network problems
  • Redundant cooling – it can be surprising just how much heat can be pumped out by a rack of servers, and heat is the enemy of computer systems.
  • Physical security – key card entry, CC cameras, etc.
  • Fire suppression systems – in case of an emergency, these will help to minimize damage and downtime.

Another important thing to look for is the ownership of the data center. If a hosting company does not own their own data center, they are to some extent at the whim of whomever they’re renting space from. How can you guarantee uptime when you do not control the physical resources that your web servers need to keep running?

Written by web hosting guy

September 22, 2008 at 4:19 pm

Posted in Uncategorized

Tagged with