当前位置:网站首页>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);
?>
边栏推荐
- How Clickhouse queries imported data within a specified time period
- Build personal leanote cloud notebook with Tencent cloud lightweight application server
- PTA 1082 shooting competition (20 points)
- What domain name does not need to be filed? What should be done for domain name filing
- Eigen eigenMatrix
- Use of golang testing framework goshub
- Spirit breath development log (12)
- Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
- The principle of defer keyword in go
- Tencent conference rest API x-tc-registered parameter policy update notification
猜你喜欢

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

How does win10 turn off f1~f12 shortcut keys?

Leetcode question brushing (question 3) - the longest substring without repeated characters
Learning routes and materials for cloud native O & M engineers

011_ Cascader cascade selector

Hard core observation 553 AI needs to identify almost everyone in the world with hundreds of billions of photos
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

Leetcode (question 2) - adding two numbers

Leetcode (question 1) - sum of two numbers

How should we learn cloud native in 2022?
随机推荐
System design: index
PHP in_ Array() function
How to change the domain name and why to rush to register the domain name
Zero code implements one-to-one table relationship and cascading save of infinite primary and child tables
The most complete regular expression summary in the whole network, so that you can get twice the result with half the effort. Collect it quickly
Use cloud functions to receive callbacks and cooperate with CLS to view callback logs and persistent storage
How to expand virtual machine capacity on vSphere client
What is primary domain name? What are the divisions of domain names
MySQL cases MySQL find out who holds the row lock (RC)
Where does the website domain name buy a normal domain name? What is the approximate price
What domain name is com? How to register a domain name
PTA 1082 shooting competition (20 points)
cuDNN installation
Blackmail virus prevention guide
[leetcode daily question] push domino
Build personal leanote cloud notebook with Tencent cloud lightweight application server
Youtech sharing | the application of Tencent Youtu multimodal graphic content identification and positioning in content security
What domain names do not need to be filed? Is there any process for domain name registration
[latest offer] 2-core 4G server is limited to 188 yuan, and it is in the process of being snapped up
How to register an overseas domain name what should be paid attention to when registering a domain name