CREATE USER 'luke'@'x.x.x.x' IDENTIFIED BY 'testpassword';Use % for wildcard host. Accessible from any locations. E.g
CREATE USER 'luke'@'%' IDENTIFIED BY 'testpassword';
SET PASSWORD FOR 'root'@'localhost'
drop user 'luke'@'x.x.x.x';
Sometimes you forget the password for a user. This is annoying as hell. You have a list of old passwords but you are able to log in as root You can use the following to confirm if the password is correct:
mysql> select if(password('randompassword')=password, 'YES', 'NO') from mysql.user where user='lukeslinux'; +-----------------------------------------------------+ | if(password('randompassword')=password, 'YES', 'NO') | +-----------------------------------------------------+ | YES | +-----------------------------------------------------+ 1 row in set (0.00 sec)