How does Linux start MySQL?
There are several methods to start MySQL on Linux, here are a few commonly used options:
- To start MySQL using the command line: Open the terminal and input the following command to start the MySQL service.
- Start the MySQL service using sudo.
- Alternatively (may vary depending on the specific Linux distribution):
- Execute the command “sudo systemctl start mysql” to start the MySQL service.
- Use the systemd startup script for MySQL: Open a terminal and enter the following command to start the MySQL service.
- Start the mysqld service using the sudo systemctl command.
- Start MySQL using the init.d script: Open the terminal and type the following command to start the MySQL service.
- Start MySQL using the following command: sudo /etc/init.d/mysql start
No matter which method you use, after starting MySQL, you can verify if MySQL has successfully started using the following command:
sudo systemctl status mysql
Or
sudo service mysql status
If MySQL starts successfully, you will see output similar to the following:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-06 09:00:00 IST; 1min ago
Main PID: 1234 (mysqld)
Tasks: 28 (limit: 234)
Memory: 157.3M
CGroup: /system.slice/mysql.service
└─1234 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid