In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the routine use of MySQL methods, the article is very detailed, has a certain reference value, interested friends must read it!
1. The main part of the database:
Tables table
View
Stored procedure
Function
Indexes
two。 Create a ruozedb database and user: the user has all permissions on this DB
Create database ruozedb
Grant all privileges on ruozedb.* to ruoze@'192.168.137.252' identified by '123456'
Grant all privileges on ruozedb.* to ruoze@'192.168.137.1' identified by '123456'
Grant all privileges on ruozedb.* to ruoze@'%' identified by '123456'
Flush privileges
The ruozedb of the MySQL database allows ruoze users to access it from which machine.
Specify which machine by ip address
%: ip of any machine
Install DBeaver software and connect to ruozedb database
3.table
Delete tabl
Drop table ruozedata
Insert data
Insert into ruozedata (name,age,address) values ('jepson',18,'www.ruozedata.com')
Check the data
Select * from ruozedata
Select * from ruozedb.ruozedata
Update data
Update a set name='lynn' where id=1; updates a's data and sets the name of id=1 to lynn
Add constraint
ALTER TABLE ruozedb.ruozedata ADD CONSTRAINT ruozedata_un UNIQUE KEY (name); modify table ruozedata to add a unique value constraint to name
Delete data
Delete from ruozedb.ruozedata where id=1; deletes all data from id=1 in the ruozedb.ruozedata table.
3.1 Field Typ
Integer int bigint
Decimal float,double (commonly used latter)
Date DATE DATATIME TIMESTAMP
String char varchar (the latter is commonly used)
3.2
The difference between DML, DDL and DCL.
General explanation:
DML (data manipulation language):
They are SELECT, UPDATE, INSERT and DELETE, and as its name suggests, these four commands are used to manipulate the data in the database.
DDL (data definition language):
DDL is more than DML, and the main commands are CREATE, ALTER, DROP and so on. DDL is mainly used to define or change the structure, data type, links and constraints of tables (TABLE). Most of them are used when creating tables.
DCL (Data Control Language):
It's a database control function. Is a statement used to set or change database user or role permissions, including (grant,deny,revoke, etc.) statements. By default, only people such as sysadmin,dbcreator,db_owner or db_securityadmin have the right to execute DCL
3.3. Create a table solidified format
Create table ruozedata (
Id int AUTO_INCREMENT primary key
Name varchar (100)
Age int
Address varchar (300)
Create_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
Create_user varchar (100)
Update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Update_user varchar (100)
);
These are all the contents of this article entitled "what are the methods commonly used by MySQL?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.