Technology Programming

How to Restart MySQL From Script

  • 1). Log in to your Linux computer and open the command line.

  • 2). Type "vim mysqlrestart.sh" and press "Enter."

  • 3). Type "i" then press "Enter" to enter the "Edit" mode on the VIM text editor.

  • 4). Type the following commands into the text file, on two separate lines:

    #!/bin/bash

    /etc/init.d/mysql restart

  • 5). Press "ESC" then type "ZZ" to save and quit the file.

  • 6). Type "chmod 755 mysqlrestart.sh" and press "Enter."

  • 7). Run the script by typing "./mysqlrestart.sh" into the terminal.



Leave a reply