In addition to the suggestions made by Pierre, you should also check the value of $cookie_domain in your settings.php file. If this is set incorrectly (e.g. to mylivesitedomain.com when you are accessing your site via localhost), then you will be unable to log in. Drupal will log you in correctly (presuming you entered the correct username and password), but the login cookie will not be sent back by your browser, so the login will not "stick".
Also, to reinforce what Pierre said about $base_url -- if this is not set correctly, the symptoms will be very similar. For example, if you log in to your site via localhost, it is common for your local web server to report 127.0.0.1 instead. Again, your login cookie will not be attached to the right domain, and you will not be logged in. In this instance, setting $base_url to localhost is the right answer. I like to do this:
$base_url = str_replace('127.0.0.1', 'localhost', $base_url);
That way, the port in $base_url will match whatever I happen to use when running the site via