In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The use of MySQL under Linux
1. Install the mysql command: sudo apt-get install-y mysql-server
2. Start the mysql command: sudo service mysql start (root permission is required to use it, without any prompt after startup)
3. Enter the mysql command after startup: mysql-u username-p password
4. Create a library: create database database_name
5. Display the list of libraries: *. Show databases
6. Select a library for operation: use database_name
7. Create a table: create table table name (column name 1 data type, column name 2 data type, …... )
Create table teacher (id int auto_increment not null primary key
Name char
Address varchar (50) default "Shenzhen"
Year date
);
Id is set as the primary key and automatically set, that is, you don't have to write to the id field when you add it.
8. Insert by row: insert into table name values (value 1, value 2,... )
Insert by column: insert into table name (column 1, column 2,... ) values (value 1, value 2,... )
9. Display the information in the table: select * from table name
10. Display the table in the library: use mysql; (open the library you want to operate)
Show tables; (display the tables in the library)
Constraint: not null (the data type is followed by not null to force the column not to accept null values).
12. Modify the data in the table: update table name set column name = new value where column name = a value
13. Delete:
① deletes rows from the table: delete
② deletes the row where the A value is located: delete from table name where column name = A value
③ deletes all lines: delete from table_name; or (delete * from table_name)
Note: open the library (use mysql;) when manipulating the library and the tables in the library.
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.