RSS

How-To Geek

For every database, you should set the root or sa passwords to something other than the default, unless you want to get hacked. For mysql, the system administrator user is usually called root, but sometimes it’s called admin or something else.

Here’s the two methods to reset the password:

From the Command Line

mysqladmin -u root password “newpassword”

mysqladmin -u root -h host_name password “newpassword”

Example:

mysqladmin -u root password ws8dr8as3

mysqladmin -u root -h localhost password ws8dr8as3

You will also want to restart the database server after running this command

sudo /etc/init.d/mysql restart

Alternative Method (from MySQL Client)

If you don’t have access to the server, or you’re running on Windows and you already know the password, you can connect to the server as root and then use the following command:

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.

Published 12/16/09

DID YOU KNOW?

The Law of Hobson-Jobson, named after the Hobson-Jobson historical dictionary authored by Henry Yule and Arthur C. Burnell in the late 19th century, is a linguistic phenomenon describing the phonological change by which loanwords from foreign languages become new words with the same meaning in their host language; examples of this include the Spanish “cucaracha” becoming “cockroach” in English and the English “riding coat” becoming “redingote” in French.