CSV file of Windows Process list

If you need a CSV file of the currently running  processes in Windows you can use the task manager command line tool.


This will dump the task list to the screen. But there are several options you can use:

C:> TASKLIST.EXE /V /FO CSV > filename.csv

The above will produce a nicely formatted CSV file with information about the process, such as CPU Time and memory used.

The full list of other options can be found at the Microsoft Technet library, well, until they move the location of it…¬†


Resetting forgotten MySQL root password

If you have forgotten your root password for MySQL, then don’t panic. Although, if you don’t have root shell access, then do panic!

Anyway, to reset a password, you need to stop MySQL and restart it with a special setting that allows you to login without passwords. Obviously this is a dangerous switch and you have to remember to stop and start MySQL after you’ve finished!


Login with superuser access (sudo su)

> /etc/init.d/mysql stop

This will stop the MySQL service on the server, and all connections will be cut off.

Then we need to start MySQL with the secret switch:

> mysqld_safe --skip-grant-tables &

I don’t get any messages after this, but you may get one saying the mysqld_safe has started.

Then connect as root:

> mysql -u root

You will be connected. And you can just assign the root user a new password:

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD(NEWPASSWORD) WHERE user = "root";
mysql> exit;

That’s it. So now, just stop and start mysql again (as superuser) and were done:

> /etc/init.d/mysql restart


Changing your MySQL root password

When you installed MySQL, you would have been asked for a root password. If you were testing or something similar, you may have used an empty password. This is all well and good until you need to put your server into production. So, how do you create one?

> mysqladmin -u root password NEWPASSWORD

This will assign the root user, the password in NEWPASSWORD

But, what if you want to change the root’s password?

> mysqladmin -u root -pOLDPASSWORD password NEWPASSWORD


> mysqladmin -u root -pabcdefg password gfedcba

The above example will change the root’s password (if it is right) from abcdefg to gfedcba (I know this isn’t a very strong password, but its only an example)

You can of course, log into MySQL to change the password for any user by following these commands:

> mysql -u root -pADMINPASSWORD
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD('NEWPASSWORD') WHERE user = "root";


If you forget your root password, then see my post on forgotten MySQL root password