Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

11.1-11.5 introduction to LAMP architecture, MySQL installation

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

11.1 introduction to LAMP architecture

LAMP=Linux+Apache (hettpd) + MySQL+PHP

Linux operating system

Apache provides web service software, the real name is httpd

MySQL storage software, data, strings, etc.

PHP scripting language, similar to shell, but more complex than shell. Mainly to make a website.

PHP website (Google, Taobao, Baidu, 51cto blog, ape forum)

The three roles can be on the same machine or separately.

(if httpd and PHP are to be together, MySQL can have a separate machine)

Introduction to LAMP Architecture

Process:

PHP is associated with Apache because PHP is combined with APACHE in the form of modules.

But Apache can't deal with MySQL directly, he can only get data from MySQL through PHP module.

After getting the data, PHP will give the results back to Apache,Apache and then the data back to the user.

The act of PHP connecting with MySQL to fetch data is called a dynamic request.

For example, log in to the ape forum as an example.

Log in to the website (ask.apelearn.com), type the account password and click login to authenticate. The login request has been sent to Apache, and then Apache checks whether the request is dynamic or static. Because the login behavior needs to submit the login information to Apache,Apache to get the account password and enter the database to match to see whether the input is right or wrong. (this process uses PHP to deal with MySQL. First, the user's account password is found in MySQL, and then PHP is compared. If correct, Apache will feedback the login status to the user, which is a dynamic request).

Static request

Visit the website, the logo displayed on the website, and the display of the logo is also requested through Apache. Apache gets the logo image and finds that the picture does not exist in the MySQL. It directly gets the file of the picture in the static file (a directory on the Linux server) and gives it back to the user directly. This process does not deal with MySQL, which is a static request.

11.2 introduction to MySQL_MariaDB

Oracle

Also do the database, this database is relatively large, such as banks, financial enterprises.

Oracle will be installed exclusively on a minicomputer, which will install Unix. This minicomputer is too supercomputer (hundreds of CPU, memory on T, etc.)

The latest version of https://www.mysql.com, MySQL official website, 5.7GA/8.0DMR

MySQL5.6 has changed greatly, and its performance has been greatly improved.

Mariadb is a branch of MySQL. The latest version of https://mariadb.com/ is 10.2.

MariaDB is mainly maintained by SkySQL (now renamed MariaDB), and SkySQL is led by the original author of MySQL

Some of the original people were founded.

The original author of MySQL led most of the original people to create.

The version of Mariadb5.5 corresponds to the 5.5 of MySQL and 10.0 corresponds to MySQL5.6.

Community Community Edition, Enterprise Enterprise Edition

GA (Generally Available) refers to a generic version that is used in a production environment and is generally used

DMR (Development Milestone Release) Development milestone release

RC (Release Candidate) release candidate version

Beta open test version

Alpha internal test version

11.3-11.5 MySQL installation

Several common installation packages for MySQL: rpm, source code, binary compiler-free

Enter the directory / usr/local/src first (put all packages in this directory later)

Cd / usr/local/src

Download the MySQL 5.6 installation package, usually x64

[root@centos7-01 src] # wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

Extract the installation package for MySQL

[root@centos7-01 src] # tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz

Move the directory of the decompressed mysql and rename it / usr/local/mysql

[root@centos7-01 src] # mv mysql-5.6.36-linux-glibc2.5-x86_64 / usr/local/mysql

[root@centos7-01 src] # cd! $

Cd / usr/local/mysql

[root@centos7-01 mysql] # ls

Bin COPYING data docs include lib man mysql-test README scripts share sql-bench support-files

Enter the directory

[root@centos7-01 mysql] # cd / usr/local/mysql/

Establish a MySQL user because this user is required to start MySQL.

[root@centos7-01 mysql] # useradd mysql

Establish datadir

# mkdir-p / data/mysql

Change permissions

# chown-R mysql:mysql / data/mysql

-- user specifies user,-- datedir specifies directory

[root@centos7-01 mysql] #. / scripts/mysql_install_db-- user=mysql-- datedir=/data/mysql

FATAL ERROR: please install the following Perl modules before executing. / scripts/mysql_install_db:

Data::Dumper

-*

If you find an installation error, you can first use grep to find the relevant words of the installation package, if you are not sure which package to install, you can install them all. The idea is to install one and then test it, one by one.

In fact, the first one is the package we are going to install. )

[root@centos7-01 mysql] # yum list | grep perl | grep-I Dumper

Perl-Data-Dumper.x86_64 2.145-3.el7 base

Perl-Data-Dumper-Concise.noarch 2.020-6.el7 epel

Perl-Data-Dumper-Names.noarch 0.03-17.el7 epel

Perl-XML-Dumper.noarch 0.81-17.el7 base

[root@centos7-01 mysql] # yum install-y perl-Data-Dumper

Test again after the installation of perl-Data-Dumper is complete.

[root@centos7-01 mysql] #. / scripts/mysql_install_db-- user=mysql-- datedir=/data/mysql

Using echo $? Check whether the execution result is successful 0 success or more than 1 failure

[root@centos7-01 mysql] # echo $?

0

At this point, initialization is complete.

Copy the configuration file for mysql and rename it my.cnf (mysql recognizes this name by default)

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

The system already has / etc/my.cnf by default

[root@Centos7-01 mysql] # ls / etc/my.cnf

/ etc/my.cnf

[root@Centos7-01 mysql] # rpm-qf / etc/my.cnf

Mariadb-libs-5.5.56-2.el7.x86_64

If you don't copy support-files/my-default.cnf, modify the path of datadir and socket in my.cnf directly.

Datadir=/data/mysql

Socket=/tmp/mysql.sock

Be sure to comment out log errors and pid errors, because their directories do not exist and errors will occur.

Copy the script file to the specified directory and rename it / etc/init.d/mysqld

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

# vi / etc/init.d/mysqld

Directory of basedir=/usr/local/mysqlmysql

Directory of datadir=/data/mysqlmysql data

[root@Centos7-01 mysql] # chmod 755 / etc/init.d/mysqld

Add mysqld to the boot service list

[root@Centos7-01 mysql] # chkconfig-add mysqld

[root@Centos7-01 mysql] # chkconfig-list

Note: this output only shows SysV services and does not include

Native systemd services. SysV configuration data

May be overridden by native systemd configuration.

To list systemd services, execute 'systemctl list-unit-files'.

To view the services enabled in a specific target, please execute

'systemctl list-dependencies [target]'.

Mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off

Netconsole 0: off 1: off 2: off 3: off 4: off 5: off 6: off

Network 0: off 1: off 2: on 3: on 4: on 5: on 6: off

/ etc/init.d/mysqld start starts the service, and the following method is the same

[root@Centos7-01 mysql] # service mysqld start

Starting MySQL.Logging to'/ data/mysql/Centos7-01.erratically.

SUCCESS!

Check the process and listening port again.

# ps aux | grep myslqd

# netstat-lntp

Another way to start the service, specify the target, in more detail.

# / usr/local/mysql/bin/mysqld_safe-defaults-file=/etc/my.cnf-user=mysql-data/mysql &

Stop the service to take advantage of killall mysqld (which is safer)

If you find that the service can't be stopped for a long time, don't use kill-9 to kill it, otherwise it will lead to data loss or corruption.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report