=== Mysql User Creation ===
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';
\\
=== Setting user password ===
SET PASSWORD FOR 'root'@'localhost'
\\
=== Deleting a user ===
drop user 'luke'@'x.x.x.x';
\\
\\
=== Checking MySQL Password ===
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)