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

Common sentences in mysqld/mariadb

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

Share

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

Create database if not exists hidb; # create a library if the library does not exist

Show warnings; # View the most recent db alarm

Alter database hidb character set 'utf-8'; # sets the database character set

Drop database testdb; # deleting a library

Show databases like'% db'; # queries database information ending in db

Help show databases; # help

Create table tbl2 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY,name VARCHAR (60) NOT NULL); # create a table structure

Create table tbl2 (id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR (60) NOT NULL,UNIQUE KEY (id,name)); # create table structure

Help desc; # help

Describe city; # query table structure

DESC tbl2; # query table structure

Show engines; # View supported engines

Show table status; # View all table status information

Show table status like 'tablename'\ G; # View single table status information

Show table status where name like 'table'; # View tables that start with table

Show table status where Engine='MyISAM'; # query engine is the table status of MyISAM

Alter table tbl3 ADD gender ENUM ('Fleming recently added M'); # modify the table structure and add enumerated fields

Alter table tbl3 CHANGE id stuid SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY; # modify the field name id to stuid

Alter table tbl3 ADD INDEX (name); # create index

Show INDEXES from tbl3; # View all indexes in the table

Alter table tbl3 drop index id; # Delete the index of the id field

Alter table tbl3 drop primary key id; # Delete the primary key of the id field

Create table tbl4 like mysql.user; # create the tbl4 table and copy the table structure from mysql.user

Create table tbl5 select host,user,passwd from mysql.user; # queries the fields and contents of the mysql.user table and puts them in the newly created table

Create index indexname on tabl5 (id); # create index

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