Run mysql as service windows 10

MySQL is a free-to-download, open source database that is widely in use. It is one of the most popular relational database management systems. Even though it is more popular with Linux servers, it is equally compatible with Windows Servers.

Run mysql as service windows 10

Using a very simple tool called MySQL Installer, you can swiftly install MySQL on a Windows 2019 server. It has a user-friendly graphical user interface (GUI).

What is MySQL Installer?

MySQL Installer is a standalone application designed to ease the complexity of installing and configuring MySQL products that run on Microsoft Windows. It also guides you through the steps needed to configure MySQL.

Prerequisites

  • Administrator privileges on Windows server.
  • MySQL Installer requires .NET Framework 4.5.2. (If you have an older version of the .NET framework, then update that in order to begin the installation process.)
  • MySQL requires Visual C++ 2019.

How Do I Install MySQL on Windows Server 2019?

Step 1:

Start by downloading MySQL Installer in Windows Server 2019. Choose the appropriate version for your server and click Download.

Run mysql as service windows 10

Step 2:

After downloading the file, run the program from the pop-up window at the bottom of your browser.

Run mysql as service windows 10

MySQL Installer Setup

Step 1:

Running the program in the previous step causes a new window with the MySQL Installer setup to appear. It prompts you to select the MySQL products to install on the host.

Run mysql as service windows 10

One option is to choose the predetermined setup type that matches your setup requirements. Here is a brief explanation of each mode:

  • Developer Default: Installs the products that complement application development with MySQL, such as MySQL Server, Shell, Router, Workbench, MySQL for Visual Studio, MySQL Connectors (for .NET, Python, ODBC, Java, and C++), MySQL Documentation, and MySQL Samples and Examples.
  • Server only: Only installs the MySQL server. This setup type installs the general availability (GA) or development release server you selected when you downloaded MySQL Installer. It uses the default installation and data paths.
  • Client only: Only installs the most recent MySQL applications and MySQL connectors. This setup type is similar to the Developer Default type, except it does not include the MySQL server or the client programs typically bundled with it, such as MySQL or mysqladmin.
  • Full: Installs all available MySQL products.
  • Custom: The custom setup type lets you filter and select individual MySQL products from the MySQL Installer catalog.

Select Server only for this tutorial.

Step 2:

MySQL Installer uses entries in the package-rules.xml file to determine whether the prerequisite software for each product is installed on the host. MySQL Installer displays the Check Requirements screen when the requirement check fails to help you update the host. In addition, it evaluates the requirements each time you download a new product (or version) for installation.

Run mysql as service windows 10

For this tutorial, you have to install Microsoft Visual C++ 2019.

Step 3:

Download the appropriate version for your server requirements and execute the file to run the installation of Microsoft Visual C++.

Run mysql as service windows 10

Click the checkbox to agree to the license agreement and click Install.

Run mysql as service windows 10

Once the setup is complete, it will show the successful installation message below. Click Close.

Run mysql as service windows 10

Step 4:

Once you’ve verified the successful Microsoft Visual C++ installation, return to the MySQL installer and click Next. You will continue with the Download screen seen below. Click Execute to download MySQL Server 8.0.29.

Run mysql as service windows 10

Once the download is complete, click Next, which will take you to install MySQL Server.

Run mysql as service windows 10

Step 5:

Once installation is complete, you are taken to the Product Configuration window, starting with Type and Networking. Choose the appropriate setting for your requirements and click Next.

Run mysql as service windows 10

Step 6:

From the Authentication Method section, select the radio button for Use Strong Password Encryption for Authentication, and click Next.

Run mysql as service windows 10

Step 7:

The next screen is the Accounts and Role window, where you can set your MySQL Root Password. Complete this section and click Next.

Run mysql as service windows 10

The Windows Service screen allows you to configure MySQL Server as a Windows service and name the MySQL service. For this tutorial, the given name is MySQL8.0. You can also start the service at System Startup and run it via the standard system account or a custom user. Make your selections and click Next.

Run mysql as service windows 10

Click Finish on the Apply Configuration screen to apply all the settings and selections.

Run mysql as service windows 10

Accessing MySQL via Command Prompt

When you run Command Prompt from the Windows Start Menu and execute the mysql command, you may encounter the error below.

Run mysql as service windows 10

This error occurs since there is no MySQL Bin added to the path. To find the MySQL Bin location, navigate to your This PC from the File Manager. Then navigate to C drive > Program Files > MySQL > MySQL Server 8.0 > bin.  Right-click on bin in the top bar and select Copy address. 

Use the cd command and paste the address in the Command Prompt to navigate to that location. Then, rerun the mysql command to see the result.

Run mysql as service windows 10

Changing Environment Variables in Windows

To run MySQL as a normal command without navigating the folder, you must specify the bin path in environment variables. Search the keyword Environment in the Windows Search and open the program Edit System Environment Variables. Click Environment Variables.

Run mysql as service windows 10

Click New under System Variables to add a new path. Add the path to the MySQL bin you copied previously. Click OK on all windows, and close the window.

Run mysql as service windows 10

You can then go to the Command Prompt and run the mysql command from any directory location on the server.

Run mysql as service windows 10

Final Thoughts

By following this guide, you can install MySQL on Windows Server 2019 with the help of MySQL Installer, which is a very user-friendly interface. This tool is excellent for those that need MySQL in their Windows environment, offering easy installation and configuration.

How do I start MySQL as a Windows service?

Extracting the Install Archive..
Creating an Option File..
Selecting a MySQL Server Type..
Initializing the Data Directory..
Starting the Server for the First Time..
Starting MySQL from the Windows Command Line..
Customizing the PATH for MySQL Tools..
Starting MySQL as a Windows Service..

How do I run MySQL on Windows 10?

Launch the MySQL Command-Line Client. To launch the client, enter the following command in a Command Prompt window: mysql -u root -p . The -p option is needed only if a root password is defined for MySQL. Enter the password when prompted.

How do I install MySQL services on Windows 10?

Installing MySQL as a Windows Service.
Browse to your MySQL's bin folder (e.g. C:\Joget-v4-Enterprise-4.0. 2\mysql-5.0. 96-win32\bin) in your command prompt..
Execute the following. mysqld --install..
You will get the following when service is installed successfully. Service successfully installed..

Should I configure MySQL as Windows service?

On Windows, It is always recommended to install and run MySQL as a Windows service, so that MySQL starts and stops automatically when Windows starts and shutdown. Also, it can be managed using the services section of control panel.