


Comments are my biggest motivation~Complete MySQL basics (storage engine and graphical management tools), mysql basics_PHP tutorial
Comments are my biggest motivation ~ MySQL basics are completed (storage engine and graphical management tools), mysql basics
hi
I logged in today and found that there were 3 comments~~ Come on!
This week’s plan is actually far from being achieved, and there are still a lot of things to do next week. . . So. . . Have fun on the weekend~
Today I tried to complete the basic knowledge of MySQL. Has a novice turned into an expert?
1. MySQL
-----Storage Engine (Getting Started)-----
----Introduction
---Intuitive example
mysql> SHOW CREATE TABLE test;
------- ---------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -----------
| Table | Create Table |
------- -------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---------------------
| test | CREATE TABLE `test` (
`id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 |
------- ---- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------
1 row in set (0.04 sec)
ENGINE=InnoDB here is a storage engine
---
MySQL can store data in files/memory using different technologies. This technology is the storage engine (that is, the storage engine is a technology, a storage technology)
The functions of various engines are different due to differences in storage mechanisms, indexing techniques, and locking levels
Also known as table type
---
The main ones supported by MySQL are
MyISAM, InnoDB, Memory, CSV, Archive
----Knowledge Point-Concurrency Processing
Ensure data consistency and integrity when multiple connections modify records
For example, when processing requests from multiple users for the same record - commonly used are shared locks (read locks) (multiple users can read the same resource, and the data will not change during the reading process), Exclusive lock (write lock) (only one user can write to the resource at any time, and writing lock will block other read lock or write lock operations)
When locking, be careful to only target the most correct objects (objects cannot be too large or too small) - table locks (a locking strategy with the least overhead), row locks (the most expensive)
----Knowledge Point-Transaction Processing
Used to ensure the integrity of the database
Meets: ACID (atomicity, consistency, isolation, durability)
----Knowledge Point-Foreign Key
Strategy to ensure data consistency (mentioned before about various keys)
----Knowledge Points-Index
A structure to sort the values of one or more columns in a data table (similar to a directory function)
Achieve fast query
----Characteristics of various engines
MyISAM: 256TB, supports indexes, table locks, and data compression - suitable for situations where there are not many transactions
InnoDB: 64TB, supports transaction security (this is the reason why this engine is often chosen), supports indexes, row locks, and supports foreign keys (also only this engine supports this) - Gao Da Shang
Memory: has storage limit (determined by memory size), supports indexes, table locks
Archive: no storage limit, supports indexes, table locks, and data compression
There are different types of indexes, let’s talk about them.
Others: CSV does not support indexing, Blackhole is used as a relay for data replication (similar to burning after reading)
The first two are the most used.
----Set storage engine
---my.ini modification
default-storage-engine=...
---CREATE TABLE table(
...
An example is as follows
mysql> CREATE TABLE tp1(
-> s1 VARCHAR(20)
-> )ENGINE=MyISAM;
Query OK, 0 rows affected (0.10 sec)
mysql> SHOW CREATE TABLE tp1;
------- ---------------------------------- -------------------------------------------------- -------------
| Table | Create Table |
------- ------------------ -------------------------------------------------- ------------------------
| tp1 | CREATE TABLE `tp1` (
`s1` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
------- -------------------------- -------------------------------------------------- ---------------
1 row in set (0.00 sec)
mysql> ALTER TABLE tp1 ENGINE=InnoDB;
Query OK, 0 rows affected (0.35 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> SHOW CREATE TABLE tp1;
------- ---------------------------------- -------------------------------------------------- -------------
| Table | Create Table |
------- ------------------ -------------------------------------------------- ------------------------
| tp1 | CREATE TABLE `tp1` (
`s1` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
------- -------------------------- -------------------------------------------------- ---------------
1 row in set (0.00 sec)
-----Graphical management tool-----
----PHPMyAdmin
Since mine is a wamp integrated environment, I can log in directly to phpmyadmin
The normal thing is to go to the phpmyadmin official website to download the version of php that corresponds to your own
After downloading and installing, you have to go to the web page to operate it. After all, it is something placed on the server side
Being able to visually operate databases, data tables, and data seems not very customary, but I personally prefer to use commands. However, visualization is convenient for finding errors and so on. You still need to experience and understand it
----Navicat
There is a Chinese version of the client
----MySQL Workbench
Client provided by the official website
I’m not going to go into details, you can find it online, and you’ll get it if you have a look around
2. AJAX
-----Introduction-----
Chinese name: Asynchronous Javascript and XML (asynchronous request, partial refresh)
is a technology that can update part of a page without reloading the entire web page
Changing the landscape of the web
Preliminary knowledge: CSS, HTML, JS
----Synchronous and asynchronous
Synchronization: (Original technology) After the client requests, the server responds and returns the processing result. The client has been waiting throughout the process - synchronization means that the client and server process simultaneously
Asynchronous: (For example, when filling in the registration information, fill in the email address, and then a green checkmark will appear on the right side of the input box soon) When there is a change on the client, (seems to) immediately send a request to the processing The server side, and then the processor side processes and returns the result. During this process, the client is still performing other operations - asynchronous operations on the client side and server side
Technical difference: the lack of the XMLHttpRequest object - used for data exchange between the background and the server
Process introduction: HTML&CSS to implement the page to express information XHR to perform asynchronous exchange of data JavaScript operates DOM to achieve dynamic partial refresh
----XMLHttpRequest (XHR) object creation
Instantiate XHR: var request=new XMLHttpRequest();
Except IE6 and previous browsers, all browsers support XHR
----HTTP request
http is a rule/protocol for computers to communicate through the network. It is a stateless (no state retained/no memory) protocol
Steps of http request: Establish TCP connection-"Browser "calls" to the server-"Server response-"Server response-"Close connection
Requests and responses have their own formats. For details, you can check "Computer Network" or similar books. You may know about GET/POST and so on, so you can continue temporarily
Note: GET uses URL to transmit data, which is all visible (clear text) and has a character limit. The advantage is that it is simple, safe and can be saved as bookmarks, etc.
There are status codes in the browser after the response that you need to understand properly: mainly look at the first one - 1xx, information type, indicating that it is being processed; 2xx, successful; 3xx, redirection, indicating that the request is unsuccessful and further action is required from the customer; 4xx, Client error means that the request submitted by the client has an error, such as 404 NOT FOUND, which means that the document referenced in the request does not exist; 5xx, server error - helpful for debugging web programs, memorize it

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.
