4.2.8. MySQL Select Database

发布时间 : 2025-10-25 13:32:50 UTC      

Page Views: 1539 views

After you connect to the MySQL database, there may be multiple operational databases, so you need to select the database you want to operate on.

Select the MySQL database from the command prompt window

You can easily select a specific database in the mysql > prompt window. You can use the SQL command to select the specified database.

Example

The following example selects the database RUNOOB:

[root@host]# mysql -u root -p Enter password:****** mysql> use RUNOOB; Database changed mysql> 

After executing the above command, you have successfully selected the RUNOOB database, which will be executed in the RUNOOB database in subsequent operations.

Use PHP script to select MySQL database

PHP provides functions mysqli_select_db To select a database. The function returns TRUE after successful execution, otherwise it returns FALSE.

Grammar

mysqli_select_db(connection,dbname); 

Parameters.

Description

connection

Necessary. Specifies the MySQL connection to be used.

dbname

Required, specify the default database to use.

Example

The following example shows how to use the mysqli_select_db Function to select a database:

Select a database

 
《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。