How does Linux start MySQL?

There are several methods to start MySQL on Linux, here are a few commonly used options:

  1. To start MySQL using the command line: Open the terminal and input the following command to start the MySQL service.
  2. Start the MySQL service using sudo.
  3. Alternatively (may vary depending on the specific Linux distribution):
  4. Execute the command “sudo systemctl start mysql” to start the MySQL service.
  5. Use the systemd startup script for MySQL: Open a terminal and enter the following command to start the MySQL service.
  6. Start the mysqld service using the sudo systemctl command.
  7. Start MySQL using the init.d script: Open the terminal and type the following command to start the MySQL service.
  8. 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
bannerAds