In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Database level operation
# check which databases show databases; # create the database create database [database name]; # display the character set show create database [database name] of the database; # the culprit that leads to database garbled when the character set is inconsistent. You can also see the proofreading rules using help create database. Create database [Database] default character set [character set, such as utf8,gbk]; # Delete database drop database [database]; # switch database use [database]; # view current database select database (); # see which tables show tables;# displays the table show tables from of the specified database [database]
User Management Settings password
# create user create user 'user' @ 'host domain'; # set password set password for 'user' @ 'host domain' = password ('password'); # create user create user 'user' @ 'host domain' password'; # delete redundant system account drop user 'user name' @ 'host domain'; # delete specified user delete from mysql.user where user=' 'and host=' host domain'; # refresh and update flush privileges
Give the right to take back
# authorize grant all on [database]. [* or table] to 'user' @ 'host domain'; # all permissions can be given to usage separately, primary select,create,update,insert,delete. Grant all privileges on [database] to 'user' @ 'host domain'; # View the user's permissions show grants for user @ host domain; # withdraw permissions revoke [permissions] on [database]. [* or table] from user @ host domain
Table operation
# create a new table create table test (field 1 type (number) parameter 1 > 2. Comment 'Chinese comment', Field 2 type (number) parameter 1pr 2.); # Type: int integer, double double precision floating point type, char fixed length string optimization efficiency, varchar variable length string, date date type # Parameter: primary key primary key, not null is not empty, auto_increment automatically grows # View the structure of the table desc [Table]; # shows the statement show create table that created the table [Table] # insert record insert into [Table] ([Field 1], [Field 2]) values ([value 1], [value 2]), ([value 1], [value 2])... ; # if you do not write fields, you can insert more than one field at the same time according to the order of the fields in the table. Inserting more than one field at a time is optimized.
Query record
Select [column name] from [table] where [field] ='[% can be matched arbitrarily]'; # View table select * from test; # View the first two lines select * from test limit 2; # start with the second line and look up the next two lines select * from test limit 2 from test order by id desc limit descending [asc ascending order] and then check the first two lines select * from test order by id desc limit 2; # range query select * from test where id > 2 and [or] id3;# empty data truncate table [Table] # insert field alter table [table] add [field name] [type parameter] after [field] Add add, change change, drop delete # change table name rename table [original table name] to [rename]
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.