Basic Theory of Linux Advanced Chapter 1 (Detailed Documentation, Apache, Website, MySQL, MySQL Backup Tool)

♥️Author: Xiao Liu at Station C

♥️Personal homepage:  Xiao Liu’s homepage 

♥️Don’t let your body become crooked just because the road of life is bumpy; don’t let your pursuit be slow just because the journey of life is long.

♥️Learn the operation and maintenance experience accumulated over the past two years, as well as a full set of network experiment tutorials on the Cisco simulator. Column:Cloud Computing Technology

♥️Thank you CSDN for allowing you and me to meet!

I hope this useful theory summarized from the hard work and sweat of operation and maintenance personnel will be helpful to you.

Table of contents

web website services

1. Characteristics of Apache

2. Apache’s main directory and configuration files

3. Main configuration file description (httpd.conf)

 web website service 2

1. Common access control methods for httpd services:

2. Authentication methods supported by httpd service:

3. Virtual host types supported by httpd:

MySQL(linux)

1. Characteristics of MySQL

2. Common operations of mysq1:

MySQL database backup and recovery (linux)

1. Database backup type

2. Common backup methods:

3. mysql configuration file description

4. Logical backup (full backup): use mysqldump to backup

5. Commonly used incremental recovery methods:


web website services

1. Characteristics of Apache

Open source code, cross-platform application
Supports multiple web programming languages
Modular design, stable operation, good security

2. Apache’s main directory and configuration files

Main directories and files:
Service directory: /usr/local/httpd
Main configuration file:/usr/local/httpd/conf/ httpd.conf
Web directory:/usr/local/httpd/htdocs
Service script:/usr/local/httpd/bin/apachectl< a i=5> Execution program:/usr/local/httpd/bin/httpd Access log: /usr/local/httpd/log/access_log Error log : /usr/local/httpd/log/error_log


3. Main configuration file description (httpd.conf)

Listen: Listening IP address and port number
User: User identity running the service
Group: Group identity running the service
ServerAdmin: Administrator’s email
ServerName: Domain name of the website server
DocumentRoot: Root directory of the web document
DirectoryIndex: Default index page file
Include: Other configuration files that need to be included


 web website service 2

1. Common access control methods for httpd services:

Client address restrictions (restrictions on IP, network segment, domain name)
User authorization restrictions (requires user name and password verification)

2. Authentication methods supported by httpd service:

Digest Authentication (Digest)
Basic Authentication (Basic)

3. Virtual host types supported by httpd:

Virtual host based on domain name
Virtual host based on IP address
Virtual host based on port


MySQL(linux)

1. Characteristics of MySQL

Multi-threaded, multi-user
Based on C/S (client/server) architecture
Easy to use, fast query speed
Safe and reliable

2. Common operations of mysq1:

(1) Mysq1 login
No password: mysq1 -u root With password: mysq1 -u root
(2) Modify the mysq1 user Password (under the system prompt #)
If there is no password, set a new password: mysqladmin -u root password New password
If there is a password, change the password: mysqladmin -u Root -P Password New Password
                             prompts to enter the old password
(3) Exit the MySQL console
exit a i=8> (4) View the list of all databases show databases; (5) View the tables in the database use Database name; show tables; (6) View the structure of the table describe table name; (7) Create database create database database name; (8) Create table use database name;< /span> drop database database name; (10) Delete database drop table table name; use database name (9) Delete table create table table name (field 1 data type, field 2 data type, ...);
















(11) Syntax for inserting data
insert into table name (field 1, field 2, ....) values ​​('value 1', 'value 2', . ..);
(12) Query the data in the table
select * from table name where condition;
(13) Update Data in the table
update table name set column name='update value' where condition;
(14) Delete data in the table
delete from table name where condition;
(15) Set user permissions (if the user does not exist, create a new user)
grant permission list on Database name.Table name to Username@source address identified by 'password';
 Note: Permission list: all (all permissions), select, update, delete, insert
Source address: localhost (this machine)
    192.168.1.100 (a host)
    192.168.1.% (represents a network segment) a> mysql -u Authorized user name [-p] -h Client address ( 18) Remote login to MySQL revoke permission list on database name.table name from username@source address; (17) Revoke user permissions: show grants for Username@source address; (16) View user permissions:
    % (representing all network segments)






MySQL database backup and recovery (linux)

1. Database backup type

(1) Physical and logical perspectives
Physical backup: cold backup, hot backup, warm backup
Logical backup: import and export a>
(2) Database backup strategy perspective
Full backup
Differential backup
Incremental backup< /span>

2. Common backup methods:

(1) Physical cold backup: main backup data files
    tar command
(2) Special backup tool: logical backup< a i=3> mysqldump     mysqlhotcopy (3) Binary log: incremental backup


3. mysql configuration file description

Main configuration: /etc/my.cnf
Data file storage location: /usr/local/mysql/data
Restart the service: systemctl restart mysqld
Service port number: tcp 3306

4. Logical backup (full backup): use mysqldump to backup

(1) Backup:
Back up a table: mysqldump -u root [-p] Library name Table name 1 [Table name 2] > /Backup path/File name< /span> Restore a library: mysql -u root [-p] < /backup path/ File name Restore a table: mysql -u root [-p] library name < /backup path/file name (2) Restore: Back up all Library: mysqldump -u root [-p] [--opt] --all-databases > /backup path/file name
Back up a database: mysqldump -u root [-p] --databases Library name 1 [Library name 2] > /Backup path/file name



5. Commonly used incremental recovery methods:

(1) General recovery: Recover all data in the entire log file.                             
(2) Based on position recovery: You can restore part of the data in the log file.               
(3) Point-in-time recovery: Only part of the data in the log file can be recovered.          

Recovery from the beginning of the log to a certain point in time:
mysqlbinlog [--no-defaults] --stop-datetime='Year-Month-Day Hour:Minute: seconds' binary log | mysql -u username -p password
Recovery from a point in time to the end of the log:
mysqlbinlog [--no-defaults] --start-datetime='year-month-day hour:minute:second' Binary log | mysql -u username -p password
Recovery from a certain point in time to a certain point in time :
mysqlbinlog [--no-defaults] --start-datetime='Year-Month-Day Hour:Minute:Second' --stop-datetime='Year-Month-Day Hour: minutes:seconds' binary log | mysql -u username -p password

--no-defaults //#Position options --start-datetime //: Point-in-time options Binary log file path: Example: mysql_bak/mysql_bin.000001

Note: The log is divided into the beginning and the end
The application method is divided into:
    From the beginning to a certain point in time
    From a certain point in time to the end
    From a certain point in time to a certain point in time

You should try your best to get through every hurdle in life. No matter what difficulties you encounter, never give up! ! !

Guess you like

Origin blog.csdn.net/lzl10211345/article/details/134402016