Blog for IT technical details

March 30, 2009

How to Reset the Root Password in MySQL

Filed under: Database — Tags: , — admin @ 9:33 am

If you have forgotten your root password previously set , you can set a new password.

For Windows system, follow the steps listed below.

Use the following procedure for resetting the password for any MySQL root accounts on Windows:

  1. Log on to your system as Administrator.
  2. Stop the MySQL server if it is running. If server is running as a Windows service, go to the Services manager to stop MySQL service.
  3. Create a text file and place the following statements in it. Replace the password with the password that you want to use.
    UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
    FLUSH PRIVILEGE;
    Here FLUSH statement tells the server to reload the grant table into memory.
  4. Save the file. For this example, the file will be named C:\mysql-init.txt.
  5. Open a console window to get to the command prompt:
  6. Start the MySQL server that looks like :
    C:\> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt
  7. After the server has started successfully, delete c:\mysql-init.txt.
  8. Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services window. You should now be able to connect to MySQL as root using the new password.

For unix kind of system,follow the steps listed below.

1.  Log on to your system as the Unix mysql user that the mysqld server runs as.
2.  Locate the .pid file that contains the server’s process ID. The exact location and name of this file depend on your distribution, host name, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the file name has an extension of .pid and begins with either mysqld or your system’s host name.

You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the path name of the .pid file in the following command:

shell> kill `cat /mysql-data-directory/host_name.pid`

3. Create a text file and place the following statements in it. Replace the password with the password that you want to use.

UPDATE mysql.user SET Password=PASSWORD(’MyNewPass’) WHERE User=’root’;
FLUSH PRIVILEGES;

The FLUSH statement tells the server to reload the grant tables into memory.
4.  Save the file. For this example, the file will be named /home/me/mysql-init.
5.  Start the MySQL server with the special –init-file option:

shell> mysqld_safe –init-file=/home/me/mysql-init &
6. After the server has started successfully, delete /home/me/mysql-init.

You should now be able to connect to MySQL as root using the new password.

You can also set the new password using the mysql client if this is run under your local box:

1. Stop mysqld and restart it with the –skip-grant-tables option.
2. Connect to the mysqld server with this command:

shell> mysql

3. Issue the following statements in the mysql client. Replace the password with the password that you want to use.

mysql> UPDATE mysql.user SET Password=PASSWORD(’MyNewPass’)
->                   WHERE User=’root’;
mysql> FLUSH PRIVILEGES;

You should now be able to connect to MySQL as root using the new password.

March 27, 2009

Defects/KLOC

Filed under: Application Development Improvement — Tags: — admin @ 10:58 am

Have you heard of defects per Lines of Code (Defects/KLOC). My company was asked to evaluate third party software application development.  One of my measurements is to use Defects/KLOC.

You may argue that Defects/KLOC doesn’t supply enough information about Product Quality. But one thing for sure is if the rate of Defects/KLOC for the similar products is high, there is certainly something wrong with development process or developer skills.

I noticed that if development follows well defined architecture might help reduce such Defects/KLOC rate. This is what I noticed from evaluating one of Ruby on Rails projects.

March 20, 2009

Hello world!

Filed under: Web 2.0 RIA — Tags: — admin @ 12:06 pm

Hi, I am starting to do some research on this web 2.0 technology. I would think that I should start a blog and post some of my findings and ideas here to share with you.

If you have any questions, comments and suggestions, please let me know. Thanks.

Powered by WordPress