LAMP architecture (LAMP introduction, mysql/mariaDB introduction, Mysql installation)

1. Introduction to LAMP architecture:

Linux+  Apache(httpd)+ mysql  +   php

Operating system + external network service software + storage software + scripting language (developed by C)

PHP website

1.png

The three roles can be installed on one machine or separated, but httpd must be together with php (php is combined with apache in the form of modules, and apache deals with mysql through php)

Dynamic request: the user logs in to apache through the account and password, and apache goes to mysql to compare the data through php, and apache will return the login status to the user after matching

Static request: The user logs in through apache, and apache directly goes to a certain directory in Linux to get static files or pictures. not dealing with mysql

 

2. Introduction to mysql/mariaDB

 

mysql is a relational database. Developed by mysql ab company. Acquired by Sun in 2008. Sun company (java) was acquired by oracle (database) company in 2009. MySQL embarked on a commercial route. Official website: www.mysql.com has changed a lot since version 5.6. 5.7 performance has been greatly improved .

mariadb is a branch of mysql. The official website is www.mariadb.com, which was founded by the original author and most of the original team. mariadb5.5 corresponds to mysql5.5, and mysql5.6 corresponds to maiadb10.0.

Community open source version

enterprise Enterprise Edition

GA generic version, used in production environments

DMR development milestones (versions with major breakthroughs)

RC Release Candidate

Beta development test version (may have bugs)

Alpha internal beta version

 

3. Mysql installation

 

uname -a View current version information

[root@lnmp ~]# uname -a

Linux lnmp 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

r.aminglinux

Installation: rpm (there is no way to customize the installation path), source code, binary compilation-free (you can customize the installation path)

 

Unzip the binary compilation-free package of mysql

tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

move him and rename him

mv mysql-5.6.36-linux-glibc2.5-x86_64   /usr/local/mysql

Switch to the /usr/local/mysql directory

create mysql user

useradd mysql

The default path for storing data files in the mysql database is /var/lib/mysql, but in practice, we often need to customize the installation database path during installation and create data

mkdir /data

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql Generate database system, specify user as mysql, store database path under /data/

Copy the configuration file to /etc/my.cnf (the my.cnf file may already exist, it may be installed before, or it may be the configuration of other databases)

cp   support-files/my-default.cnf /etc/my.cnf        

 

Copy the mysql startup script and edit

cp support-files/mysql.server  /etc/init.d/mysqld

 

vim /etc/init.d/mysqld

basedir=/usr/local/mysql specifies the mysql program directory

datadir=/data/mysql specifies the mysql storage data directory

Set permissions to 755 (sometimes the default is 755)

chmod 755 /etc/init.d/mysqld     

 

If you want to boot, add it to the system service list

chkconfig --add mysqld add to system service list

chkconfig --list View system service list

 

service mysqld start / /etc/init.d/mysqld start is to start the mysql service

pa aux|grep mysql View process

netstat -lntp View listening ports

 

1.png                                 Another way to start MySQL, the ampersand means throw it to the background

killall mysqld kills the mysql process (don't use the kill command often)

MySQL common 2 engines 

innodb is bigger and myisam is smaller

 

The difference between killall and kill Killall is very rational, it will end the process after the read and write is completed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325025951&siteId=291194637