当前位置:网站首页>Summary of common mysql8 commands in centos7 environment

Summary of common mysql8 commands in centos7 environment

2022-06-10 21:51:00 1024 Q

Catalog

Preface

One 、 Common sentences

1、 Sign in & sign out

2、 Common operations

attach : Common sentences

summary

Preface

CentOS7 install MySQL8 The detailed steps

MySQL View table footprint

MySQL: Range query optimization

CentOS7 + MySQL8

One 、 Common sentences 1、 Sign in & sign out # Connect to the database of this server mysql -u root -p# sign out exit/*-----------------------------------------*/# Other servers connect to the database # Introduction to database connection . Instruction is mysql, The common options are :# -h: host host# -P: port prot# -u: user name user# -p: User password 123456mysql -h172.22.1.143 -u root -P 6399 -p1234562、 Common operations # See what databases are show databases; # Create a database create database video_db;# Choose to use video_db database use video_db;# View tables in the database show tables;# View the currently selected database select database();# see video_info Table all field information desc video_info; attach : Common sentences // If no error is reported during startup, the startup is successful , Even if “Redirecting to /bin/systemctl start mysql.service”// In specific cases, you can use the status query instruction to query its status .service mysqld start # Use service start-up mysql service service mysqld status # see MYSQL Running state service mysqld stop # Use service stop it mysql service service mysqld restart # Use service restart mysql service // Inquire about mysql edition (1) Terminal execution mysql -V (2)mysql Inside view select version();// Connect to database mysql -u root -p # Log in to my cloud service as an administrator pscode yes (tantan_esc Same as ):zS+qq.quit # sign out mysql/*-----------------------------------------*/ Introduction to database connection . Instruction is mysql, The common options are :-h: host host-P: port prot-u: user name user-p: User password passcode-A: Do not read database information in advance ( When there are many tables in the database, the pre Reading database information will be so slow that it will get stuck ) Table name : You can add the library name at the end . This is equivalent to entering the database directly , It's equivalent to executing once use Library name ; give an example : Examples are as follows , Pay attention to the last one -p No spaces ....!!!!......mysql -h 100.65.202.233 -P 4236 -u uds_root [email protected]/*-----------------------------------------*/create database shop;// Create a database show databases; // See what databases are use shop; // Choose to use shop database select database(); // View the currently selected database show tables; // View tables in the database select * from biao1; // see biao1 The data of drop table chengji; // Delete table chengji; show columns from biao1; // see biao1 create table chengji(yingyu int,yuwen int,shuxue int);// newly build chengji surface , And insert response fields alter table chengji add meishu varchar(50) not null; // To watch chengji Add fields to meishu; rename table chengji to chengji2; // Change the name of the grade to grade 2 show create table biao1; # View the table creation statement select count(*) from mytable; # see mytable Common operation examples of data volume in the table :insert into t_XXX_search_config (FCorpUin,FDisplay,FTopPos,FQuality,FActivity) values(2852158899,4,10000,0,0) limit 1;update t_XXX_search_config set FDisplay = 888 where FCorpUin = 1820140703 limit 1;delete from XXXXX_BIZ.t_xxxxx_all where FKFUin = 800853466 limit 1;delete from table_name; # Clear table data summary

This is about CentOS7 In the environment MySQL8 This is the end of the article on common commands , More about CentOS7 MySQL8 Please search the previous articles of SDN or continue to browse the related articles below. I hope you can support SDN more in the future !


原网站

版权声明
本文为[1024 Q]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206102028062513.html