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--
This article mainly introduces to you the simple method of using the basic statements of MySQL database, the contents of the articles are carefully selected and edited by the author, and have a certain pertinence, which is of great significance to everyone's reference, so let's learn about the simple method of using the basic statements of MySQL database with the author.
Simple use of MySQL database statements
1. Exit the mysql > command tool and return to the original shell environment.
Quit or exit
2. View the current database service log file information
Show master logs
3. View the libraries contained in the current MySQL server.
Show databases
4. View the tables contained in the current library.
Show tables
5. Display the structure of the table, that is, the information of the fields (columns) that make up the table.
Use library name-> DESCRIBE table name
Or
Describe library name. Table name
6. Modify and update the data records in the table
Update table name set column name = value where condition
7. Refresh user authorization information
Flush privileges
8. Delete data records
Delete from table name where conditional format
9. Authorization
Grant permission list on library name. Table name to 'user name' @ 'Source address' [identified by 'password']
Permission list: select, update, insert. Use all to represent all permissions.
Source address: domain name or IP address. For example:% .benet.com or 192.168.1%
Identified by: used to set the password string value that the user uses to connect to the database.
Name of the library. Table name: used to specify the name of the authorized library and table, where the wildcard'*': all.
10. View database user authorization information
Show grants for 'user name' @ 'Source address'
11. Backup
Export some tables in the library
Mysqldump option library name table name 1 table name 2. >
/ backup path / backup file name
Export one or more complete databases (including all tables in them)
Mysqldump option-databases library name library name 1 library name 2. >
/ backup path / backup file
Back up all libraries in the MySQL server
Mysqldump option-- all-databases > / backup path / backup files. Sql
-u: specify the database user name
-p: specify the database user password
-- opt: optimize execution speed
For example:
Mysqldump-u root-p-- opt-- all-databases > data.sql
12. Restore the database
Mysql option library name table name < / backup path / backup file
(note: if you are deleting a table, go to the backup file before recovery and delete the drop and then restore it)
After reading the above simple methods of using the basic sentences of MySQL database, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.
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.