0
0
MysqlHow-ToBeginner · 3 min read

How to Start MySQL Server: Simple Steps to Run MySQL

To start the MySQL server, use the command sudo systemctl start mysql on Linux systems with systemd. On Windows, start the MySQL service from the Services app or run net start mysql in Command Prompt.
📐

Syntax

Starting the MySQL server depends on your operating system and how MySQL was installed. Here are common commands:

  • Linux (systemd): sudo systemctl start mysql starts the MySQL service.
  • Linux (SysVinit): sudo service mysql start starts the server.
  • Windows: Use net start mysql in Command Prompt or start the service from the Services app.
bash
sudo systemctl start mysql
💻

Example

This example shows how to start the MySQL server on a Linux system using systemd. You run the command in a terminal with administrator rights.

bash
sudo systemctl start mysql
sudo systemctl status mysql
Output
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2024-06-20 10:00:00 UTC; 5s ago Main PID: 1234 (mysqld) Tasks: 29 (limit: 4915) Memory: 150.0M CGroup: /system.slice/mysql.service └─1234 /usr/sbin/mysqld
⚠️

Common Pitfalls

Common mistakes when starting MySQL server include:

  • Not running the command with sudo or administrator rights, causing permission errors.
  • Using the wrong service name, for example, mysql vs mysqld, depending on the installation.
  • Trying to start MySQL when it is already running, which may cause errors.
  • Not having MySQL installed or configured properly before starting.
bash
Wrong:
service mysqld start

Right:
sudo systemctl start mysql
📊

Quick Reference

Operating SystemCommand to Start MySQL Server
Linux (systemd)sudo systemctl start mysql
Linux (SysVinit)sudo service mysql start
Windows (Command Prompt)net start mysql
Windows (Services app)Start MySQL service manually

Key Takeaways

Use administrator rights (sudo or admin) to start the MySQL server.
On Linux with systemd, use 'sudo systemctl start mysql' to start the server.
On Windows, start MySQL via 'net start mysql' or the Services app.
Check the service name if the start command fails; it might be 'mysqld' or 'mysql'.
Ensure MySQL is installed and configured before trying to start the server.