MySQLi Select Database

mysqli_select_db - Selects the default database for database queries.

Below the syntax

bool mysqli_select_db($link, $dbname)

Parameters:

  • link: Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init().
  • dbname: The database name.

Below the example to select a database:

<?php
   $conn  = mysqli_connect('localhost:3306', 'user_name', 'password');
   if(! $conn) {
       die('Could not connect: ' . mysqli_error());
   }
   mysqli_select_db($conn, "db_nexladder");
   mysqli_close($conn);
 ?>

In MySQL console, You can use command USE to select a particular database.

USE `db_nexladder`;

It'll look like

mysqli create database 3