Home >Database >Mysql Tutorial >How to create a database with mysql

How to create a database with mysql

anonymity
anonymityOriginal
2019-05-09 16:42:5414656browse

How to create a database with mysql

Related learning recommendations: mysql tutorial

Database, in short, can be regarded as an electronic file cabinet ——A place where electronic files are stored. Users can add, intercept, update, delete and other operations on the data in the files.

The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application.

1. Use MySQL to create a database:

Create using the command line

We can log in to the MySQL service, Use the create command to create a database. The syntax is as follows:

CREATE DATABASE database name;

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

[root@host]# mysql -u root -p   
Enter password:******  # 登录后进入终端
mysql> create DATABASE test;

2. Use mysqladmin to create a database

Using a normal user, you may need specific permissions to create or delete a MySQL database.

So we use the root user to log in. The root user has the highest authority and can use the mysql mysqladmin command to create the database.

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

[root@host]# mysqladmin -u root -p create test
Enter password:******

After the above command is successfully executed, the MySQL database test will be created.

The above is the detailed content of How to create a database with mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn