Home>Article>Database> How to create a new database in mysql?

How to create a new database in mysql?

藏色散人
藏色散人 Original
2019-05-09 10:16:11 96981browse

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\
D:\MySQL\bin>mysql -u root -p

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;

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

mysql> create database mydb;

Delete the database (if the database is named mydb )

mysql> drop database accounts;

Use database (if using database mydb)

mysql> use mydb;

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!

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