Mysql trickery

From Docupedia

Adding a new user:

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE on database.* to 'user'@'localhost' 
IDENTIFIED BY  'passw0rd';

Or maybe you want all permissions:

mysql> GRANT ALL ON database.* to 'admin'@'localhost' IDENTIFIED BY 'passw0rd';

Updating a password for a specific user at a specific host:

mysql> UPDATE user SET Password=password('passw0rd') 
WHERE User='userNAME' and Host='dev04.alkaloid.net';

FLUSH PRIVILEGES;

Setting the root password after a fresh mysql-server install:

mysql> use mysql;
mysql> UPDATE user SET Password=password('rootpassw0rd') 
WHERE User='root' and Host='localhost';


Checkout what you have for hosts and users:

mysql> select host, user from mysql.user;

Remove a user:

mysql> delete from user where host='dev01.alkaloid.net' and user='userNAME';
mysql> delete from db where host='dev01.alkaloid.net' and user='userNAME';

Adding a new database:

mysql> create database swoosh;

Adding contents of an sql file to that database:

dev01#> mysql -u root swoosh < swoosh.sql

Changing a users password in mediawiki:

UPDATE user SET user_password =
 md5(CONCAT('123-',md5('newpassword'))) WHERE user_id=123;

So if you were a retarded user who's userid was 7 and your new password was going to be 1234 your update string would be:

 UPDATE doc_user SET user_password = md5(CONCAT('7-',md5('1234'))) WHERE user_id=7;

This also assumes you have used doc_ to prepend all table names. Good luck!