How do I start MySQL if the PID file is missing?

If the PID file of MySQL is missing, you can restart MySQL by following these steps:

  1. Open the terminal or command prompt.
  2. Navigate to the installation directory of MySQL, for example:
  3. Change directory to /usr/local/mysql.
  4. Run the following command to start the MySQL server:
  5. Run the MySQL server safely with grant tables skipped.
  6. This will start the MySQL server and skip permission verification. Note that MySQL will not request a password at this time, but all users will be able to access the database. Therefore, this should only be used in a testing or temporary environment.
  7. To recreate the PID file, you can execute the following command in another terminal or command prompt window.
  8. Please close the MySQL server by running the command “sudo ./bin/mysqladmin -u root -p shutdown.”
  9. This will shut down the MySQL server using administrator privileges. Simply press Enter when prompted to enter the password.
  10. Then return to the first terminal or command prompt window, and restart the MySQL server.
  11. Run the MySQL server using the command “sudo ./bin/mysqld_safe &”
  12. This will start the MySQL server and create a new PID file.

Please note that the above steps are only applicable if MySQL is installed in the default location. If MySQL is installed in a different location, please modify the path in step 2 accordingly.

bannerAds