Home >Database >Mysql Tutorial >How to create a new MySQL database in Linux

How to create a new MySQL database in Linux

WBOY
WBOYforward
2023-05-30 18:22:062130browse

How to create a new MySQL database in Linux

First log in to MySQL

 mysql -u root -p
 //之后输入自己的root密码

Create a new database mynewdatabase

 create database mynewdatabase;
 //注意别漏了“;”分号哦

Create a new database now Created a database mynewdatabase

Let’s check it out:

 show databases;

In the list you can find the database named mynewdatabase you just created

If you want to delete the database, you can use the command:

 drop database mynewdatabase;
 //删除名为mynewdatabase的数据库

To summarize:

 //创建数据库
 create database [database name];
 //查看数据库
 show databases;
 //删除数据库
 drop database [database name];

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

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete