Mysql to create a database two ways _mysql

Source: Internet
Author: User
Tags create database

This article for you to share two kinds of MySQL to create a database method for your reference, the specific content as follows

The first method: using Mysqladmin to create a database
with ordinary users, you may need specific permissions to create or delete MySQL databases.

So we're logged in with the root user and the root user has the highest privileges and can use the MySQL mysqladmin command to create the database.

Instance

The following command briefly demonstrates the process of creating a database named Tutorials:

[root@host]# mysqladmin-u root-p Create tutorials
Enter password:******
The MySQL database tutorials is created after the above command has been successfully executed.

The second method: Creating a database using PHP scripts
PHP uses the mysql_query function to create or delete MySQL databases.

The function has two parameters that return TRUE if the execution succeeds, or FALSE.

Syntax:bool mysql_query (SQL, connection);


Instance

The following example demonstrates the use of PHP to create a database:

 
 

The above is MySQL to create a database of two methods, I hope to help you learn, but also hope that we support the cloud habitat community.

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.