当前位置:网站首页>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);
?>
边栏推荐
- Where is the cheaper domain name? What should I pay attention to when buying a domain name?
- Is there a free ECS? What should I pay attention to when I rent a server
- How unity runs code every few frames
- What is the third level domain name? How to choose a domain name agent
- PTA 1056 sum of combinations (15 points)
- What cloud native knowledge should programmers master?
- SUSE system cannot install cosfs solution
- How does the mobile phone remotely connect to the ECS? What should be paid attention to during the operation
- How to create a virtual machine on vSphere client -- a reliable virtual machine creation tutorial
- Share 10 creative projects of Gaoxing!
猜你喜欢

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

Answer questions! This article explains the automated testing framework in software testing from beginning to end
Learning routes and materials for cloud native O & M engineers

011_ Cascader cascade selector
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

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

How should we learn cloud native in 2022?

Leetcode question brushing (question 3) - the longest substring without repeated characters

014_ TimePicker time selector
What cloud native knowledge should programmers master?
随机推荐
What are clustering, distribution, and microservices?
The function of nearby people in the applet is realized, and the cloud development database is used to realize nearby people and friends within a distance of the neighborhood
CTF learning notes 17:iwesec file upload vulnerability-02 file name filtering bypass
Build your unique online image
How the query address of cloud native monitoring data exposes the public network
CTF learning notes 18:iwesec file upload vulnerability-03-content-type filtering bypass
The conference assistant hidden in wechat is the best way to work efficiently!
Hard core JS: there may be a memory leak in your program
What kind of intelligent connection design do we need in an interconnected society?
Why domain name should be resolved? What is the domain name registration query
August 20, 2021: brick making. There is a binary grid of m x n, where 1 table
4G industrial VPN router
How to clone virtual machines on vspere client
Build personal leanote cloud notebook with Tencent cloud lightweight application server
Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
Oceanus practice - use of the Nepal graph connector in the graph database
Performance comparison of JS loop traversal methods: for/while/for in/for/map/foreach/every
How to register a free website domain name
What cloud native knowledge should programmers master?
[jest] summary of the use of automated test jest