PHP must first connect to the specified database to operate the database. The mysql_connect function we used before is no longer supported by some PHP versions. Currently, the editor uses the mysqli_connect function to link to the database. The usage is the same as mysql Basically similar.This article introduces how to use the mysqli_connect function and examples. Friends who need it can refer to
## Recommended related mysql video tutorials: "mysql tutorial"
Introduction to mysqli_connect
php mysqli_connect is used to connect to the mysql server. This function has multiple parameters and the syntax is as follows
mysqli_connect(host,username,password,dbname,port,socket);
The parameters are as follows:
host Optional. Specify the hostname or IP address. username Optional. Specifies the MySQL username. password Optional. Specifies the MySQL password. dbname Optional. Specifies the database to use by default. port Optional. Specifies the port number to attempt to connect to the MySQL server. socket Optional. Specifies the socket or named pipe to use.But we generally only need to know the following four parameters:
host Optional. Specify the hostname or IP address. username Optional. Specifies the MySQL username. password Optional. Specifies the MySQL password. dbname Optional. Specifies the database to use by default.mysql_connect instance