Installing MySQL on Windows

Installing MySQL on Windows

Your downloaded MySQL is neatly packaged with an installer. Download the installer package, unzip it anywhere and run setup.exe.

By default, this process will install everything under C:\mysql.

Verify MySQL installation

Once MySQL has been successfully installed, the base tables have been initialized, and the server has been started, you can verify its working via some simple tests.

Open your MySQL Command Line Client, it should be appeared with a mysql> prompt. If you have set any password, write your password here. Now, you are connected to the MySQL server and you can execute all the SQL command at mysql> prompt

For example: Check the already created databases with show databases command:

1sq

Primary key

A primary key is a single field or combination of fields that contains a unique record. It must be filled. None of the field of primary key can contain a null value. A table can have only one primary key.

MySQL Create Database

A database is a collection of data. MySQL allows us to store and retrieve the data from the database in a efficient way. In MySQL, we can create a database using the CREATE DATABASE statement.

You can create a MySQL database by using MySQL Command Line Client. Open the MySQL console and write down password, if you set one while installation.

2sq

Now you are ready to create database.

Syntax:

  1. CREATE DATABASE database_name;

Example:

Let’s take an example to create a database name “employees”

  1. CREATE DATABASE employees;

It will look like

3sq

Now You can check the created database by the following query:

  1. SHOW DATABASES;

11