


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

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
