当前位置:网站首页>Select MySQL database from the command prompt window
Select MySQL database from the command prompt window
2022-06-24 05:21:00 【User 4988376】
Select... From the command prompt window MySQL database
stay mysql> In the prompt window, you can simply select a specific database . You can use SQL Command to select the specified database .
example
The following example selects the database RUNOOB:
[[email protected]]# mysql -u root -p Enter password:****** mysql> use RUNOOB; Database changed mysql>
After executing the above order , You've already made the choice RUNOOB database , In subsequent operations, it will be in RUNOOB Execute... In the database .
Be careful : All database names , Table name , Table fields are case sensitive . So you're using SQL You need to enter the correct name for the command .
Use PHP Script selection MySQL database
PHP Provides functions mysqli_select_db To select a database . Function returns after successful execution TRUE , Otherwise return to FALSE .
grammar
mysqli_select_db(connection,dbname);
Parameters | describe |
|---|---|
connection | It's necessary . Stipulate what to use MySQL Connect . |
dbname | It's necessary , Specify the default database to use . |
example
The following example shows how to use mysqli_select_db Function to select a database :
Select database
<?php
$dbhost = 'localhost'; // mysql Server host address
$dbuser = 'root'; // mysql user name
$dbpass = '123456'; // mysql User name, password
$conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die(' The connection fails : ' . mysqli_error($conn));
}
echo ' Successful connection ';
mysqli_select_db($conn, 'RUNOOB' );
mysqli_close($conn);
?>
边栏推荐
- 4G industrial VPN router
- What is cloud server? How to access the ECS Homepage
- What is a top-level domain name? Is it expensive to register a domain name
- How does a R & d make a small demand bigger and bigger step by step
- Analysis of PHP environment configuration
- What domain name is cheap? How much does it cost to register a domain name?
- How to register a domain name how to make the domain name short and easy to remember
- Easy to understand JDBC tutorial - absolutely suitable for zero Foundation
- What domain name is better? What should I pay attention to when buying a domain name
- PHP key() function
猜你喜欢

What are the disadvantages of the free IP address replacement tool?

014_ TimePicker time selector
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

Hard core observation 553 AI needs to identify almost everyone in the world with hundreds of billions of photos

Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players

Answer questions! This article explains the automated testing framework in software testing from beginning to end

Leetcode (question 1) - sum of two numbers
Learning routes and materials for cloud native O & M engineers

How does win10 turn off f1~f12 shortcut keys?
Easy to understand JDBC tutorial - absolutely suitable for zero Foundation
随机推荐
[competition experience sharing] [Tencent internal track rank6] goose Rose Square half hand (TAS) experience
Three methods of local storage
[Tencent cloud] new enterprise users go to the cloud & the latest discount 2022!
2021-08-27: the normal odometer will display natural numbers in turn to indicate mileage, Kyrgyzstan
Error 0xc0000013, 0xc000007b, etc. due to the conflict between the CD-ROM drive letter and the drive letter in the business program path
Blackmail virus prevention guide
Shuttle global levitation button
What is the use of domain name cloud resolution? What are the factors for domain name errors
NAT
PHP sort() function
How to apply for a domain name for free? What is the importance of domain names?
Have you got the programmer's drawing tools and skills?
GDB debugging container and command saving
How to register a free website domain name
IBM v3700 brief configuration process
What server does domain name and IP address convert through? How does the server convert?
What is required for domain name filing and how to select an enterprise domain name
Analysis of PHP environment configuration
CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass
Go mode