MySQL creates a database in two ways: mysql creates a database in two ways

Source: Internet
Author: User

MySQL creates a database in two ways: mysql creates a database in two ways

This article shares two methods for creating a MySQL database for your reference. The specific content is as follows:

Method 1:Use mysqladmin to create a database
For normal users, you may need specific permissions to create or delete MySQL databases.

Therefore, we use the root user to log on. the root user has the highest permissions and can use the mysql mysqladmin command to create a database.

Instance

The following command demonstrates the process of creating a database. The data name is TUTORIALS:

[Root @ host] # mysqladmin-u root-p create TUTORIALS
Enter password :******
After the preceding command is successfully executed, the MySQL database TUTORIALS is created.

Method 2:Use a PHP script to create a database
PHP uses the mysql_query function to create or delete a MySQL database.

This function has two parameters. TRUE is returned when execution is successful. Otherwise, FALSE is returned.

Syntax: bool mysql_query (SQL, connection );


Instance

The following example demonstrates how to create a database using PHP:

The above two methods are used to create databases in MySQL. I hope they will be helpful for your learning, and I hope you can provide more support to the customer center.

Related Article

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.