Reset MySQL root Password

by Tweak on April 22, 2011
in Mysql

To reset MySQL root user’s password, follow the following steps.

  1. Terminate all running instances of MySQL server. You can do that either via the RC script (/etc/init.d/<script_name> stop or /user/local/etc/rc.d/<script_name> stop for FreeBSD) or using the tools like kill and pkill. To use kill or pkill, you will have to use ps or pgrep to find out the process names or process ID (PID).

    Using the RC script to do a proper shutdown is safer than using kill or pkill.

  2. Start the MySQL server in safe modemysqld_safe --skip-grant-tables --user=mysql
  3. On another terminal, login to the MySQL server as the root usermysql -u root
    Read more…

Reset lost root password in MySQL

by Tweak on October 10, 2010
in Mysql

This is a handy procedure that can be used to reset the root password for the MySQL account. I had to use this procedure on a failed installation. It appeared that I had a problem with the bin/install_db command, and it failed to pre-populate the mysql.user table with the correct initial permissions and grants. Without this information, I was dead in the water. I had an empty grant / access table so I couldn’t log in.

The following sequence was taken to correct this problem: Read more…

Simple Password Protection using PHP

by Tweak on June 8, 2009
in Php

Learn how to super protect your files without the use of mySQL.

This tutorial will help you learn how to password protect your file quickly and easily in a few lines of code.

The code can be split up into three if-else statements. Let’s take a look at what we will have to do in order to set up the password protection:

  1. If the user has not been authenticated, then use the PHP header and ask for a username and password.
  2. Else, if the user’s name is “tweak” and the password is “tweak”, log in. Inside here you would put all the code for the user.
  3. Else tell them the user/password failed.

Read more…