Documentation Home
MySQL PHP API
Download this Manual
PDF (US Ltr) - 2.4Mb
PDF (A4) - 2.4Mb
HTML Download (TGZ) - 250.9Kb
HTML Download (Zip) - 258.4Kb


MySQL PHP API  /  ...  /  Session::createSchema

5.27.4 Session::createSchema

Copyright 1997-2019 the PHP Documentation Group.

  • Session::createSchema

    Create new schema

Description

public mysql_xdevapi\Schema mysql_xdevapi\Session::createSchema(string schema_name);

Creates a new schema.

Parameters

schema_name

Name of the schema to create.

Return Values

A Schema object on success, and emits an exception on failure.

Examples

Example 5.114 mysql_xdevapi\Session::createSchema example

<?php
$uri  = 'mysqlx://happyuser:password@127.0.0.1:33060/';
$sess = mysql_xdevapi\getSession($uri);

try {

    if ($schema = $sess->createSchema('fruit')) {
        echo "Info: I created a schema named 'fruit'\n";
    }
    
} catch (Exception $e) {

   echo $e->getMessage();

}
?>

The above example will output something similar to:


Info: I created a schema named 'fruit'