Introduction to commonly used MySQL commands in Linux environment

Introduction to commonly used MySQL commands in Linux environment

Enter the mysql command:

mysql -u+(user name) -p+(password)

The mysql statement command must be followed by a ";"

Query library name:

show databases;

Modify the library:

use library name;

Create a library:

create database 【if not exists】【database name】;

Query Creation Library:

show create database 【database name】;

Query to create table:

show create table [table name];

Query table:

desc [table name];

Query the currently used library:

 select database();

Create the table:

create table 【if not exists】table name (attribute)

To remove a library:

drop database [database name]

Delete a table:

drop table [table name] 

For example:

create table student (int id (length) (extra attributes), name varchar (length));

The default length of the int type in the database is 11

 If varchar does not provide a length, an error will be reported

Not null:

not null

Auto-increment:

auto_increment

Primary Key:

primary key (attribute name) 

Attributes are separated by ","

Character Set:

charset 【Type】

Storage Engine:

engin

This is the end of this article about the commonly used MySQL commands in the Linux environment. For more relevant MySQL commands in Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Introduction to the process of installing MySQL 8.0 in Linux environment
  • Tutorial on installing MySQL under Linux
  • Steps and pitfalls of upgrading linux mysql5.5 to mysql5.7
  • Tutorial on installing mysql5.7.36 database in Linux environment

<<:  About the processing of adaptive layout (using float and margin negative margin)

>>:  Case analysis of several MySQL update operations

Recommend

How to install and configure Redis in CentOS7

Introduction There is no need to introduce Redis ...

js implements random roll call

This article shares the specific code of js to im...

Two common solutions to html text overflow display ellipsis characters

Method 1: Use CSS overflow omission to solve The ...

Example code for implementing fullpage.js full-screen scrolling effect with CSS

When I was studying CSS recently, I found that I ...

Introduction to SSL certificate installation and deployment steps under Nginx

Table of contents Problem description: Installati...

Detailed explanation of MySQL sql_mode query and setting

1. Execute SQL to view select @@session.sql_mode;...

Exploration and correction of the weird behavior of parseInt() in js

Background: I wonder if you have noticed that if ...

Beginners learn some HTML tags (3)

Related articles: Beginners learn some HTML tags ...

How to set up scheduled tasks in Linux and Windows

Table of contents Linux 1. Basic use of crontab 2...

Detailed explanation of Vue development website SEO optimization method

Because the data binding mechanism of Vue and oth...

MySQL 8.0.11 Community Green Edition Installation Steps Diagram for Windows

In this tutorial, we use the latest MySQL communi...

Mysql inner join on usage examples (must read)

Grammatical rules SELECT column_name(s) FROM tabl...

Introduction to the usage of exists and except in SQL Server

Table of contents 1. exists 1.1 Description 1.2 E...