First, please make sure caps lock is not on. Note that on some portable models, the LED on the caps lock key may not work when you first start up if FileVault is active. When caps lock is on, there will be an up-arrow icon in the text box where you enter the password. Rely on that, not on the LED.
Another reason why the password might not be recognized is that the keyboard layout (input source) in the login screen is not what you expect. You can select one of the available layouts by choosing from the flag menu in the upper right corner, if it's showing, or else cycle through them by pressing the key combination command-space or command-option-space.
If the user account is associated with an Apple ID, and you know the Apple ID password, then maybe theApple ID can be used to reset your user account password. In OS X 10.10 and later, this option also works with FileVault, but only if you enabled it when you activated FileVault. It's not retroactive. Otherwise, see below.
Note: If you've activated FileVault, this procedure doesn't apply. Follow instead the instructions on this page, under the heading "If you forget your password."
Start up in Recovery mode. When the OS X Utilities window appears, select
Utilities ▹ Terminal
from the menu bar at the top of the screen—not from any of the items in the OS X Utilities window.
In the window that opens, type this:
resetp
Press the tab key. The partial command you typed will automatically be completed to this:
resetpassword
Press return. A Reset Password window opens. Close the Terminal window to get it out of the way.
Select the startup volume ("Macintosh HD," unless you gave it a different name) if not already selected. You won't be able to do this if FileVault is active.
Select your username from the menu labeled Select the user account if not already selected.
Follow the prompts to reset the password. It's safest to choose a password that includes only the characters a-z, A-Z, and 0-9.
Select
▹ Restart
from the menu bar.
You should now be able to log in with the new password, but the Keychain will be reset (empty.) If you've forgotten the Keychain password (which is ordinarily the same as the login password), there's no way to recover it.