01.php and MySQL

Source: Internet
Author: User

Create a database

The CREATE DATABASE statement is used for creating databases in MySQL.

    • Before creating a database, we first need to connect to the database server
    Header // prevent Chinese garbled characters    $conn=mysqli_connect("localhost", "root", "");      if (! $conn ) {         diemysqli_connect_error()); // If the connection fails, output a message and exit the current script    }
    • After connecting the database, we can use the CREATE DATABASE statement to create one, and in the following code we will create a database named Myshop.
    /* Create a database */    $sql = "CREATE DATABASE myshop";

So we create a database, run, we can open our database to see if this has been created successfully, here I use WAMP integrated MySQL database, the database address is http://127.0.0.1:8080/ phpMyAdmin, after opening, we will see the following interface: On the left is a list of our database, in this list, we can see that we have just created the Myshop this database has been created.

01.php and MySQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.