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:
- Open the terminal or command prompt.
- Navigate to the installation directory of MySQL, for example:
- Change directory to /usr/local/mysql.
- Run the following command to start the MySQL server:
- Run the MySQL server safely with grant tables skipped.
- 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.
- To recreate the PID file, you can execute the following command in another terminal or command prompt window.
- Please close the MySQL server by running the command “sudo ./bin/mysqladmin -u root -p shutdown.”
- This will shut down the MySQL server using administrator privileges. Simply press Enter when prompted to enter the password.
- Then return to the first terminal or command prompt window, and restart the MySQL server.
- Run the MySQL server using the command “sudo ./bin/mysqld_safe &”
- 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.