Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL Select Database

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MySQL Select Database

After you connect to MySQL, there may be multiple databases that you can work with, so you need to select the database you want to work with.

Select MySQL database from the command prompt window

In the mysql> prompt window it is easy to select a specific database. You can use SQL commands to select a specific database.

examples

The following example selects database RUNOOB:

[root@host]# mysql -u root -pEnter password:******mysql> use RUNOOB;Database changedmysql>

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

Note: All database names, table names, and table fields are case-sensitive. So you need to enter the correct name when using SQL commands.

Using PHP scripts to select MySQL databases

PHP provides the mysqli_select_db function to select a database. Function returns TRUE on success, FALSE otherwise.

syntax mysqli_select_db(connection,dbname); parameter description connection required. Specify the MySQL connection to use. dbname Required, specifies the default database to use. examples

The following example shows how to select a database using the mysqli_select_db function:

select database

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report