Resetting MySQL root password

Forgot mysql root password? Follow the steps given below to reset it.

Step 1:

Stop the currently running mysql daemon.

sudo service mysql stop

OR

 sudo /etc/init.d/mysql stop

Step 2:

Start mysql with --skip-grant-tables

sudo /usr/sbin/mysqld --skip-grant-tables &

Step 3:

Start the mysql client without a password

mysql -u root

Step 4:

From the client, flush privileges

 FLUSH PRIVILEGES;

Step 5:

Reset password by executing the following from mysql client

SET PASSWORD FOR root@'localhost' = PASSWORD('newpassword');

Step 6:

Reset password for all root, if remote connection is enabled, from mysql client

UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root';

Step 7:

Run flush priveleges again, from the client

FLUSH PRIVILEGES;

Step 8:

Exit the mysql client

exit

Step 9:

Restart mysql

sudo service mysql stop
sudo service mysql start

OR

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

Your password has been successfully reset. Now you may login  using your new password.

Asterisk/Freepbx - Cannot record call after fetching it from parking lot -- FIX


Asterisk is not recording calls that are fetched from park. Here is my call flow.
  1. A calls to Asterisk Server(AS)
  2. Call is picked up by extension B
  3. B does an attended transfer by dialling *2200 (200 is my default parking lot)
  4. C dials 1 to fetch the parked call
  5. C dials *1 to record the call.
Recording is not done. Here is a fix that worked for me. Hope this helps someone.


In the asterisk log i found that asterisk tries to record to an invalid file with no filename, just an extension(.wav). It executed 2 files - /var/lib/asterisk/agi-bin/parkfetch.agi and /var/lib/asterisk/bin/one_touch_record.php. one_touch_record.php generates filename from data read from channel, like year, date, mixmonitor folder etc, but as there was no valid filename in the log, these should be null here.
$mixMonDir = getVariable($channel, "MIXMON_DIR");
$year = getVariable($channel, "YEAR");
$month = getVariable($channel, "MONTH");
$day = getVariable($channel, "DAY");
$mixMonFormat = getVariable($channel, "MIXMON_FORMAT");
$mixMonPost = getVariable($channel, "MIXMON_POST");
$astman->mixmonitor($channel, "{$mixMonDir}{$year}/{$month}/{$day}/{$callFileName}.{$mixMonFormat}", "a", $mixMonPost, rand());
So i inspected the parkfetch.agi were i found that these channel vars are copied only if REC_STATUS is "RECORDING" and in this case REC_STATUS is "INITIALIZED". So i added an OR clause ie i changed if ($rec_status == "RECORDING") to if ($rec_status == "RECORDING" || $rec_status=="INITIALIZED")
if ($channel)
{
 $rec_status = get_var("IMPORT($channel,REC_STATUS)");
 $agi->set_variable('REC_STATUS', $rec_status);
 if ($rec_status == "RECORDING" ||  $rec_status=="INITIALIZED") {
 foreach (array('MIXMON_DIR', 'YEAR', 'MONTH', 'DAY',  'CALLFILENAME', 'MIXMON_FORMAT', 'MIXMON_POST',  'MON_FMT') as $v) {
  $agi->set_variable($v, get_var("IMPORT($channel,$v)"));
  }
 }
}
And it worked. Now when I pressed *1 after fetching call from park, it is getting recorded. Hope dev team finds and fix this bug. I was using Asterisk 11.2.1.