Regularly restart MySQL and regularly restart Apache [task plan]

Source: Internet
Author: User

Sometimes it is thought that the server runs too long and MySQL cannot be released in the program, resulting in excessive pressure on the server. Therefore, let's imagine that Apache and MySQL memory will be released without restarting the server.

First, restart Apache.

Procedure:

Start> program> accessories> Management Tools> Task Plan

Add a task plan> next> Apache restart> select a time (I set it to every morning)> click OK.

MySQL restarts.

I used MySQL 4.0.17 and did not find the MySQL restart execution file. Therefore, I made one myself.

The following code is used:

@ Echo off

Net stop MySQL

Net start MySQL

Copy the above file, save it to notepad, and rename it C: mysql_restart.bat.

Continue the operations of the preceding Task Plan

Add a task scheduler> next> browse> mysql_restart.bat> set the time.

Of course, another method I found on the Internet is to save the following content as C: restart. bat

The following code is used:

@ Echo off

Net stop apache2

Net start apache2

Net stop MySQL

Net start MySQL

Run cmd to execute the command "at C: restart. Bat"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.