Home > Database > Mysql Tutorial > body text

How to create a new database in mysql?

藏色散人
Release: 2022-01-12 15:36:58
Original
97248 people have browsed it

How to create a new database in mysql?

Under Windows, if your MySQL is installed in D:\MySQL, you can do this:

1. First switch to its bin directory

cd D:\MySQL\bin\
Copy after login
D:\MySQL\bin>mysql -u root -p
Copy after login

2. Then enter your root password

Then you can create a database, create a user, create and modify tables and other operations (common commands are as follows).

3. View the existing database

mysql> show databases;
Copy after login

mysql Create a database (if the database is named mydb)

mysql> create database mydb;
Copy after login

Delete the database (if the database is named mydb )

mysql> drop database accounts;
Copy after login

Use database (if using database mydb)

mysql> use mydb;
Copy after login

After executing the use database command, you can create, modify, insert, and delete tables in the database Wait for operations. A database is equivalent to an Excel file, and a table is equivalent to the cells of the Excel file, and the data is stored in the table.

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template