MySQL Connection

To connect to MySQL Server, we should know mysqladmin username and password.
The following syntax is used to connect through command prompt.

shell>mysql -h host -u username -p
Enter password:******

host represents the host name where mysql is running and and username represents username.
A welcome message will be display after successful connection.

baseurl.'/images/mysqllogin.png'; ?> alt="mysqlconnection">

You can omit hostname if you are working on the same machine where mysql is installed.

Like -
shell>mysql -u username -p
Enter password:******    
The mysql> prompt indicates to enter your next command.

If you are using mysql for PHP, then PHP provides mysql_connect method to connect to mysql.

mysql_connect(host, username, password);

MySQL Disconnect Connection

QUIT commend is used to disconnect from the current connection.