Skip to main content

A short tutorial on installing the MySQL server on a Windows System and teaches you basic database administration tasks like starting /stopping MySQL server,adding user to the database, backing up the database etc.

 

 

Installing MySQL Server on Windows

First thing to do is to install the MySQL server from the Oracle Website. Here we are using a Windows System. So select the Windows binary for the MySQL Community Server. You can then run the installer on Windows 10.

 

how to install mysql community server on windows 10 to interface with Python

 

After finishing the install. Run the MySQL Configurator program. 

run mysql configurator program on windows 10 to set up root password and other users

It is also available from Start Menu.

using mysql configurator to set the user and root password on windows 10

 

Start the MySQL Configurator and select the location where your databases will be stored on disk.

 

where is the data directory for MySQL server located on Windows

 

Now  you can select the network type and port number to use .Stick with defaults here.

 

configure network type and port number to use for MySQL Serverin Windows 10

 

Here Port number is 3306,If some other program is using the same port number ,you can change it to different number like 3307 or 3308.

 

how to configure the root password for your windows 10 mysql server installation

Now  provide a password for your root account. Make sure that you use a strong password. Do remember to note down the password somewhere safe.

You can also create other user accounts and specify their roles and permissions here.

 

how to configure mysql server to run as a windows service

Here you can configure the MySQL server to run as a Windows Service. You can also make the server start  automatically after Windows boots up.

You can view the MySQL service inside the Windows Services by typing services.msc inside the Run.exe box in Windows 10.

 

how to run services.msc to view mysql process in windows services

 

You can see the MySQL83 service name below inside Windows services.

 

how to view ,stop,start mysql server in windows service

 

 

You can also install the sample databases using the MySQL Configurator

 

install sample databases on mysql server on windows for interfacing with Python and crud

 

 

Add MySQL Server Programs to Path Variable 

After finishing up the MySQL Configurator. You can add the bin folder of the MySQL installation to Path Variable. So you can access all the programs available in the bin folder.

C:\Program Files\MySQL\MySQL Server 8.3\bin

Type "path" in search box on Windows 10 

and open it.

 add mysql to path in Windows 10

Open "Environment Variables" in "System Properties"

add mysql to path in Windows 10

Select Path, Click Edit 

add mysql ,mysqld to path in Windows

Click New ,Add the Path and Press Ok.

 

Logging into MySQL from Command line

You can log into the MySQL database using either the shell provided by the installation which can be accessed from the command line.

logging into mysql database from command line

You can also login to the MySQL Client named mysql.exe and talk with the MySQL Server (mysqld.exe) from command line using the following format 

mysql -u user_name -p 

Please make sure that bin folder of MySQL is added to Path before doing that.

So here we will log in as root user, So

mysql -u root -p 

after which password for the root account has to be provided.

logging into mysql from command line on windows.

 

how mysql client communicates with mysql server

MySQL client (mysql.exe) communicates with the MySQL Server (mysqld.exe) using TCP/IP sockets as shown above.

Starting and stopping MySQL Server

Here we will learn to start and stop the MySQL Server process from Windows command line.

To start the MySQL Server process from command line use the net start command which is used to start a windows service. You need to have admin privilege's to use the net start command. Right click on cmd window and Run as Administer.

Basic syntax is as follows

net start service_name 

Here our MySQL installation is configured as a Windows service (mysql83). We have to give the name of the service instead of mysqld.exe.

net start mysql83

You can stop the mysql server using the net stop command.

net stop mysql83
starting and stopping mysql server service on windows using net start and net stop commands

 

Checking MySQL server status using mysqladmin

You can use the mysqladmin to check whether the server is running or not using the ping argument.

mysqladmin -u root -p ping

It would print out a short message as shown below if the server is running.

using mysqladmin to ping mysql server to check whether it is running or not

if the server is not running 

 

Another command to check the status of the server is 

mysqladmin -u root -p status
command to check the status of the mysql server is

 

Add a user to MySQL DBMS

 

 

Tags