In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following brings you about how to use mysql database content, I believe you must have read similar articles. What's the difference between what we bring to everyone? Let's take a look at the text. I'm sure you'll get something after reading how to use the mysql database.
I. the basic concept of database
1. Two commonly used engines:
(1) InnoDB engine:
1) support ACID, which simply supports transaction integrity and consistency
2) support row locking, consistent reading similar to ORACLE, and multi-user concurrency
3) unique clustered index primary key design, which can greatly improve concurrent read and write performance
4) Foreign keys are supported
5) support self-repair of crash data
6) InnoDB is designed to deal with large-capacity database systems, and its CPU utilization is incomparable to that of other disk-based relational database engines.
7) it is a reliable transaction processing engine and does not support full-text search
(2) MyISAM engine:
1) atomicity of each query is not supported.
2) only table offices are supported
3) the emphasis is on performance, which is faster than the InnoDB type, but does not provide transaction support
4) if you perform a large number of SELECT (delete tasks), MyISAM is a better choice
2. Introduction of the database:
1) Database-database: a container (usually a file or group of files) that holds organized data
2) Table-table: a structured list of data of a particular type
3) Schema-schema: information about the layout and characteristics of databases and tables
4) column-column: a field in a table where all tables are made up of one or more columns
5) Line-row: a record in the table
6) data type-datatype: the type of data allowed. Each table column has a corresponding data type, which limits (or allows) the data stored in that column.
2. Mysql command line (as shown below)
1. Connect mysql-- format:
Mysql-h host address-u user name-p user password
1) to connect to the local Mysql, first open the DOS window (shortcut key window field key + R call up the command instruction box and then enter cmd), then enter the directory mysql\ bin, and then type the command mysql-u root-p. You will be prompted for your password after you enter. The prompt for MYSQL is: mysql > (the default root user does not have a password)
2) connect to the Mysql on the remote host: assuming that the IP of the remote host is: 218.105.110.116, the user name is root, and the password is abcd123456, type the following command: mysql-h318.105.110.116-u root-p abcd123456;.
2. Start the mysql service:
Net start mysql
3. Stop the mysql service:
Net stop mysql
4. Query whether the port conflicts:
Netstat-na | findstr 8080 to check the listening port, and findstr is used to find whether the latter port exists.
5. Exit mysql:
Quit or exit quit
6. Modify password: format:
Mysqladmin-u username-p old password password new password
For example, change the password for root:
Mysqladmin-u root-p ab12 password djg345
Third, display commands
1. Display the list of databases in the current database server:
Mysql > SHOW DATABASES
2. Display the data table in a database:
Mysql > USE library name; / / use a library; mysql > SHOW TABLES;// lists all the tables in the library
3. Display the structure of the data table:
Mysql > DESCRIBE table name
4. Set up the database:
Mysql > CREATE DATABASE library name
5. Establish a data sheet:
Mysql > USE library name. Mysql > CREATE TABLE table name (field name VARCHAR (20), field name CHAR (1)
6. Delete the database:
Mysql > DROP DATABASE library name
7. Delete the data table:
Mysql > DROP TABLE table name
8. Empty the records in the table:
Mysql > DELETE FROM table name
9. Display the records in the table:
Mysql > SELECT * FROM table name
10. Insert a record into the table:
Mysql > INSERT INTO table name VALUES ("hyq", "M")
11. Update data in the table:
Mysql- > UPDATE table name SET field name 1 roomrooma name, field name 2 roomb' WHERE field name 3roomroomc'
12. Load the data into the data table in text:
Mysql > LOAD DATA LOCAL INFILE "D:/mysql.txt" INTO TABLE table name
13. Import .sql file command:
Mysql > USE database name; mysql > SOURCE d:/mysql.sql
14. Change the root password on the command line:
Mysql > UPDATEmysql.userSETpassword=PASSWORD ('new password') WHERE User='root';mysql > FLUSH PRIVILEGES
15. Display the database name of use:
Mysql > SELECT DATABASE ()
16. Display the current user:
Mysql > SELECT USER ()
Do you think it's what you want about how to use the mysql database above? If you want to know more about it, you can continue to follow our industry information section.
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.