MySQL - Connection

You can establish the MySQL database server connection using the mysql command at the command prompt or using php mysql function.

MYSQL Command

You can use below command with server name, username and password to establish connection with mysql server.

[root@host]# mysql -u root -p
Enter password:*********

This will give you the mysql> command prompt where you will be able to execute any SQL command.

PHP MYSQL function
Also you can establish connection with mysql server using PHP function script.

$link=mysqli_connect(SERVER,USERNAME,PASSWORD);

This mysqli_connect function needs mysql server name, username and passoword.
It is used to open connection with mysql server. It returns MySQL link identifier on success or false on failure.

Comments

Leave a Reply

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

30970