In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Change the mysql login password:
In the process of using the database server, you may forget your login password for various reasons, or you may need to use someone else's database server, but others may forget your login password and so on.
There are two ways to forget your password. One is to change the login password through the sql statement:
Second, by modifying the my.ini configuration file under the mysql installation directory, find [mysqld] in the configuration file, and then write a sentence below: sikp-grant-tables. Then restart the database server, and you can skip password verification.
Example:
1.
two。
Sql statement type:
DDL: structure creation statements that can create, delete, modify, index, view, stored procedures, shape structures
DML: data update statement, specializing in manipulating data, and the operation is limited, the basic operation of the data in the table. The main function is to add, delete, check and change, most of which are using query statements.
DQL, a branch of DML: query statement, which is responsible for query
DCL: the statement to control and manipulate the database
Basic statement:
Show databases; shows how many databases are in the database server.
Use database name; connect to a database and select a database.
Show tables; displays all table names in the selected database.
Desc table name; shows the structure of the table (some databases can support it).
Exit; exits the database console.
Quit; exits the database console.
Show databases; code example:
Use database name; code example:
Show tables; code example:
Desc table name; code example:
Exit; code example (in the same way as quit):
DDL type statement:
There is a database before a table, so you need to create a database first. The sql statement to create a database is: create database database name
After you have created a database, you can create a table in it. The sql statement to create the table is:
CREATE TABLE table name (
Column name type characteristics
Column name type characteristics
);
Example:
Code example:
An introduction to common data types, of which those marked in red are the most commonly used:
Char text type
Varchar string with a total length of 3000
Decimal (5Pol 2) indicates that the total length of the number is 5 digits, with 2 decimal places.
The total length of int is 11
Bit only has 0 and 1
Date YMD format date type
Datetime date + time type
Booleam Boolean type
Double double precision floating point type
Float floating point type
Text large text type, how many megabytes of data can be put
Long long integer
What is the primary key and what is the meaning of the primary key?
The table we just created has a structural problem, and the performance is quite poor because we don't write the primary key. What is the primary key? When a column is declared as a primary key, the value of the column is unique and cannot be repeated.
The significance of the primary key is to establish a directory of data for us to delete, add, modify, a single query, etc., you can operate according to the primary key. Because the value of the primary key is unique, it is much faster to operate.
Code example:
Joint primary key:
A federated primary key is that multiple columns can be used as primary keys.
Code example:
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.