Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to operate the database in cmd command line mode

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you cmd command line mode how to operate the database, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

View databases, tables, data fields and data

1 first configure the environment variable to enter mysql or open the mysql command line through one-click integration tool or mysql visualization tool to open the command line

Entering such an interface, different machines operate differently, so we will not describe them one by one here.

2 View all current databases

Show databases

3 Select (enter) the database

Use database name

4 View all the tables in the current database

Show tables

5 View the field structure of a table

Desc shows that

6 query table data

Select * from table name

Create a new database, data table (table), data (add data)

1 create a new database

Create database database name

Enter the new database to create a table

2 New table

CREATE TABLE table name (field name data type decoration)

Note that there must be at least one field, decorations and data types are not specified here, keywords are used between uppercase fields, and the last line is not used.

3 add data

Insert into table name valuse (value, value)

Modify the data table and modify the data

1 modify the data table

(1) alter table table name add field name type modifier [added column at the end of the table]

(2) alter table table name add field name type modifies an after column [add a new column after a column]

(3) alter table table name add field name type parameter first [add new column first]

2 modify data

Update user set name= new value where

3 different methods for modifying database version

RENAME database oldname TO newname; (the latest 5.2 or above seems to have been abandoned, please refer to other methods if necessary)

The version has been abandoned

Delete databases, data tables and data

1 Delete the database

Drop database database name

2 delete the data table

Drop table table name

3 delete data

Delete from table name where

These are all the contents of the article "how to operate the database in cmd command line mode". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report