Wednesday, August 10, 2011

Reset MySql Root Password

first stop mysql service and start mysql in safe mode using the following command

service mysqld stop
mysqld_safe --skip-grant-tables &



now connetc to mysql using the following command
mysql  enter(return character)

mysql> use mysql
mysql> update user set Password=PASSWORD('passw0rd') where user='root';
mysql> flush privileges;
mysql> exit;

now password has be reset. kill mysqld_safe deamon and start mysql service using the following command

service mysqld start
now you can enter to mysql console using the new password

Wednesday, May 25, 2011

RAM DISK --- 2nd Porcedure

you can create RAM disk or temporary file system using the following command

mount -t tmpfs -o size=32M tmpfs /var/lib/asterisk/

the above command will mount /var/lib/asterisk/ directory in the RAM and its size will be 32Mb.

you normally use RAM disk for the applications that require intensive io operation. using ram disk will increase hardisk life and also increase performance of application by reducing access time.







Sunday, January 30, 2011

MySQL PHP Exampler

  1. mysql_connect("localhost", "username", "password") or die(mysql_error());
  2.  
  3. echo " Step 1. Insert data
    "
    ;
  4. $sql = "INSERT INTO users (name,city,web,age) VALUES ('Tom','Vegas','www.tom.com',5)";
  5. $result = mysql_query($sql);
  6.  
  7. if ($result){
  8. echo "Data was inserted! ";
  9. } else {
  10. echo "An error occured during insert! ";
  11. }
  12.  
  13. $result = mysql_query("SELECT * FROM users");
  14.  
  15. while($row = mysql_fetch_assoc($result)){
  16. echo "ID: ".$row['id'].", Name:".$row['name']
  17. .", City:".$row['city'].", Age:".$row['age']." ";
  18. }
  19.  
  20. echo " Step 2. Update data
    "
    ;
  21. $sql = "UPDATE users SET age=45 WHERE name='Tom'";
  22. $result = mysql_query($sql);
  23.  
  24. if ($result){
  25. echo "Data was updated! ";
  26. } else {
  27. echo "An error occured during update! ";
  28. }
  29.  
  30. $result = mysql_query("SELECT * FROM users");
  31.  
  32. while($row = mysql_fetch_assoc($result)){
  33. echo "ID: ".$row['id'].", Name:".$row['name']
  34. .", City:".$row['city'].", Age:".$row['age']." ";
  35. }
  36.  
  37. echo " Step 3. Remove data
    "
    ;
  38. $sql = "DELETE FROM users WHERE name='Tom'";
  39. $result = mysql_query($sql);
  40.  
  41. if ($result){
  42. echo "Data was removed! ";
  43. } else {
  44. echo "An error occured during remove! ";
  45. }
  46.  
  47. $result = mysql_query("SELECT * FROM users");
  48.  
  49. while($row = mysql_fetch_assoc($result)){
  50. echo "ID: ".$row['id'].", Name:".$row['name']
  51. .", City:".$row['city'].", Age:".$row['age']." ";
  52. }
  53.  
  54. ?>

Saturday, January 29, 2011

Asterisk Voice Prompts

you can download asterisk voice prompts in different language using the following link.

http://downloads.asterisk.org/pub/telephony/sounds/




Wednesday, January 26, 2011

MsSQL dump to remote server

was running out of disk space on a server today. The server had a large database table that was no longer used, so I wanted to archive it and then drop the table. But the server didn’t have enough disk space to dump it out to disk before copying it off to a remote server for archiving.
The first thought was to run mysqldump dump on the destination machine, and to access the database over the network. That however, doesn’t compress or encrypt the data. Plus I would have had to create a mysql user with permission to access the database remotely.
The solution I came up with worked out well: mysqldump directly to the remote host with this command:

mysqldump [mysqldump options] | gzip -c | ssh user@remotehost "cat > /path/to/some-file.sql.gz"

That pipes the mysqldump command through gzip, then to through and SSH connection. SSH on the remote side runs the ‘cat’ command to read the stdin, then redirects that to the actual file where I want it saved.

Audio Format Converter For Asterisk

you can convert audio format for asterisk ivr from the following links.

http://www.digium.com/en/products/ivr/audio-converter.php

other option is to use imagic audio editor or sox