In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
First, after installation
1After installation in root Linux, the password is empty. Use the following command to create the password.
[root@host] # mysqladmin-u root password "new_password"
2, connect to the MySQL server
[root@host] # mysql-u root-pEnter password:*
3. Exit quit or exit
[root@host] # quit [root@host] # exit II, database operation
1, view all databases
[root@host] # show databases
2, create the database
[root@host] # create database database name charset utf8
3. Delete the database
[root@host] # drop database database name
4. Switch the database
[root@host] # use database name
5. View the database you are using
[root@host] # select database (); III, table operation
1, view all tables in the database
[root@host] # show tables
2, create a table
Auto_increment: indicates self-growing primary key: primary key not null: not empty [root@host] # create table table name (column type)
Example
[root@host] # create table student (id int auto_increment primary key,name varchar (20) not null,gender tinyint not null,address varchar (40), isDelete tinyint default 0) ENGINE=InnoDB DEFAULT CHARSET=utf8
3, delete the table
[root@host] # drop table table name
4, view the table structure
[root@host] # desc table name; IV, data manipulation
1, insert data
INSERT INTO table_name (field1, field2,...fieldN) VALUES (value1, value2,...valueN)
2 where statement
SELECT field1, field2,...fieldN FROM table_name1, table_ name2...[WHERE condition1 [AND [OR]] condition2. You can use one or more tables in the query statement, using commas, splits, and where statements to set query conditions. You can specify any condition in the WHERE clause. You can specify one or more conditions using AND or OR. The WHERE clause can also be applied to SQL's DELETE or UPDATE commands. The WHERE clause is similar to the if condition in a program language, reading the specified data according to the field values in the MySQL table.
3. Query data
In the SELECT column_name,column_nameFROM table_ name [where Clause] [LIMIT N] [OFFSET M] query statement, you can use one or more tables, split the tables with commas (,), and use the where statement to set the query conditions. The SELECT command can read one or more records. You can use an asterisk (*) instead of other fields. The SELECT statement returns all the field data of the table. You can use the WHERE statement to include any condition. You can use the LIMIT property to set the number of records returned. You can specify the data offset to start the query with the SELECT statement through OFFSET. The offset is 0 by default.
4Query update query
UPDATE table_name SET field1=new-value1, field2=new-value2 [WHERE Clause]
5Die delete statement
DELETE FROM table_name [WHERE Clause] if no WHERE clause is specified, all records in the MySQL table will be deleted.
5meme like clause
%: any character of any length _: matches any single character SELECT field1, field2,...fieldN FROM table_nameWHERE field1 LIKE condition1 [AND [OR]] filed2 = 'somevalue'
Example
Mysql > use RUNOOB;Database changedmysql > SELECT * from runoob_tbl WHERE runoob_author LIKE'% COM' +-+ | runoob_id | runoob_title | runoob_author | submission_date | +- -- +-+ | 3 | Learning Java | RUNOOB.COM | 2015-05-01 | | 4 | Learning Python | RUNOOB.COM | 2016-03-06 | +- -+ 2 rows in set (0.01 sec)
Finally, there is a link to add users, delete users and authorized blogs on MySQL.
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.