How do you start MySQL in Linux?
There are two ways to start MySQL in Linux: one is to start it through the command line, and the other is to start it through a service.
- Start MySQL from the command line.
- Open the terminal window.
- To start the MySQL service, enter the following command: sudo service mysql start.
- Enter the administrator password (if prompted).
- The MySQL service will start.
- Start MySQL through the service:
- Open the terminal window.
- Use the following command to start the MySQL service: sudo systemctl start mysql
- Enter the administrator password (if prompted).
- The MySQL service will start.
Regardless of the method used, after starting the MySQL service, you can log in to the MySQL server using the mysql command. For example, you can enter the following command to log in to the MySQL server:
mysql -u root -p
Then just enter the administrator password to log in.