OpenSource For You

TIPS &TRICKS

-

Auto restart Apache after every .conf file change

Shown below are the steps to auto restart Apache after every change made to the .conf file.

If ‘incron’ is already installed in your system, then skip Steps 1 and 2.

$ sudo apt-get install incron $ sudo nano /etc/incron.allow

Add <USERNAME> at the end of this file and save. $ sudo incrontab -e

Once the incrontab is open in editable mode, add the following line at the end of the content:

/etc/apache2/apache2.conf IN_MODIFY /usr/sbin/service apache2 restart

Save and exit the file.

From now on, every change in the /etc/apache2/ apache2.conf file will trigger /usr/sbin/service apache2 restart to restart the Apache server. You can also use incron to perform other useful tasks.

—Swapnil Srivastava, srivastava.swapnil99@ gmail.com

Recovering the MySQL root password

There are so many situations in which you need to recover the root password of your MySQL installati­on. To recover the password, first stop the MySQL service, as follows:

# /etc/init.d/mysqld stop Add skip-grant-tables by editing the my.cnf file: # vim /etc/my.cnf

After opening the file in any text editor, add skip-granttable­s under the [mysqld] section. Save and exit the file. Now you can start the MySQL service, as follows:

# /etc/init.d/mysqld start

Next, you need to log into the MySQL server without any password, as shown below:

# mysql

Use the following code to reset the password for the ‘root’ user:

mysql> use mysql mysql> UPDATE user SET password=PASSWORD('new_pass') where user='root';

For flush privileges, use the code shown below:

mysql> flush privileges; mysql> exit

Now, revert back to the previous state by stopping the MySQL service, as follows:

# /etc/init.d/mysqld stop

Edit my.cnf and remove skip-grant-tables.

After saving the my.cnf file, you can start the MySQL service:

# /etc/init.d/mysqld start

Now you can log in with the new password, using the following command:

# mysql -u root -p new_pass —Kishor Gavali, kishorgava­li@gmail.com

 ??  ??
 ??  ??

Newspapers in English

Newspapers from India