Example HTML page

Database Server Connection

Connecting to the SQL Server and Disconnecting from the SQL Server

In this post, I am going to explain how to connect with the SQL server in our system after the proper installation of MySQL software. Later we also observe how to disconnecting from the SQL server.

Connecting to the Server
Method 1: [ From Command Prompt]

First open command prompt, go the directory where the SQL installed files are available.  After Installing the software the files will be available in ‘C’ drive. In my PC, i have the files in this path. I have also attached the screenshot below.

C:\Program Files (x86)\MySQL\MySQL Server 5.5\bin

Connecting to the MySQL Server

To connect with the server, generally we have to give the user name and password. If the server is running on other machine then you have to pass in which host the server is running.

mysql -h localhost -u user -p

Here, I have given three options.

-h : In which host the server is running.

-u : What is the user name?

-p : Password

If you enter the above command at the command prompt it asks the password. Once you enter the password, it will display introductory information of MySQL followed by mysql> prompt

Here -h host is required if the server is running in other system. But if the server is running in the same machine then you omit this option. Simply the following command is also works for you.

mysql -u user -p

if prompts the password, after entering the correct password, you will be connected to the MySQL server.

Method 2: [ Directly from SQL Prompt]

This method is very easy to connect with MySQL server.

Type ‘mysql’ at run, you will get the MySQL command prompt option, Just click on that, it prompts the password, after entering the correct password it is automatically connects to the MySQL server.

Search for Direct SQL Prompt
Disconnecting from the Server

Disconnecting from the server is very easy. Type Quit or exit in the SQL prompt. now you are away from the server connection.

Disconnecting from the SQL Server
Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest