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 use navicat for mysql command line operation

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article will explain in detail how to use navicat for mysql command line operation. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

1. Open Navicat

2. Click the "tools" menu and select "Command Line Interface".

3. Enter the mysql command line at this time

Extended data: MySQL basic operation command

Database operation

Show all databases

Mysql > show databases; (Note: there is an s at the end)

Create a database

Mysql > create database test

Connect to the database

Mysql > use test

View the database currently in use

Mysql > select database ()

Table information contained in the current database

Mysql > show tables; (Note: there is an s at the end)

Delete database

Mysql > drop database test

Table operation

Note: use "use" before operation to connect to a database.

Build a table

Command: create table ([,.. ])

Example:

Mysql > create table MyClass (> id int (4) not null primary key auto_increment, > name char (20) not null, > sex int (4) not null default '0mm, > degree double (16L2))

Get table structure

Command: desc table name, or show columns from table name

Example:

Mysql > describe MyClassmysql > desc MyClass;mysql > show columns from MyClass

Delete tabl

Command: drop table

For example: delete a table named MyClass

Mysql > drop table MyClass

Insert data

Command: insert into [[,.. ])] Values (value 1) [, (value n)]

Example:

Mysql > insert into MyClass values (1), (2), (2)

Query the data in the table

Query all rows

Mysql > select * from MyClass

Query the first few rows of data

For example: view the first two rows of data in table MyClass

Mysql > select * from MyClass order by id limit 0Pol 2

Or

Mysql > select * from MyClass limit 0Pol 2

Delete data from the table

Command: delete from table name where expression

For example: delete the record numbered 1 in table MyClass

Mysql > delete from MyClass where id=1

Modify the data in the table

Command: update table name set field = new value,... Where condition

Mysql > update MyClass set name='Mary' where id=1

Add fields to the table

Command: alter table table name add field type other

For example, a field passtest is added to the table MyClass, with a type of int (4) and a default value of 0

Mysql > alter table MyClass add passtest int (4) default'0'

Change the table name

Command: rename table original table name to new table name

For example: change the name of MyClass to YouClass in the table

Mysql > rename table MyClass to YouClass

Update field content

Command: update table name set field name = new content

Update table name set field name = replace (field name, 'old content', 'new content')

For example, add 4 spaces in front of the article

Update article set content=concat (', content); on how to use navicat for mysql command line operations to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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