Introduction to Lamp, MySQL architecture and MySQL installation

Source: Internet
Author: User

First, lamp architecture introduction

1? is a shorthand, it contains four things:
Linux operating system;
Apache (httpd) is a Web services software;
MySQL data storage software;
PHP scripting language, similar to shell, more complex than the shell, usually used to do the site;

How 2?HTTPD, PHP, and MySQL work,
User browser----Apache (PHP Module)---(Static file, MySQL)

Apache and PHP is a whole, PHP is a module in the form of a combination with Apache, Apache can not directly deal with MySQL directly, only php this module to take data;

Ii. introduction of MYSQL/MARIADB

MySQL is a relational database, developed by MySQL AB, was acquired by Sun for $1 billion in 2008, and in 2009, Sun was acquired by Oracle for $7.4 billion,
MySQL official website https://www.mysql.com from 5.6 to change relatively big, 5.7 performance has greatly improved;
(The system used for banking is UNIX, charged)
MARIADB is a branch of MySQL, official website: https://mariadb.com Latest Version 10.2
Mariadb mainly by Skysql company, Skysql Company by the original author of MySQL led most of the original squad,
Mariadb5.5 version corresponds to mysql5.5,10.0 MySQL5.6
Community Community Edition, Enterprise Business Edition, GA (generally Available) General edition, used in production environments; DMR (development Milestone release) Development milestone release, RC ( Release Candidate) releases candidate version, beta Open test version, alpha internal beta version;

Third, the installation of MySQL

1, MySQL common installation package: RPM binary Compiler-free, source code
2, uname-a View the version number of the native system,
3. Download 5.6_64 bit binary package to/USR/LOCAL/SRC
4. Unpack the Package
5? MV Mysql-5.6.36-linux-glibc2.5-x86_64/usr/local/mysql
6. Create MySQL user, useradd MySQL
7. Create the Data directory
8?./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
Many errors occur during this process: to confirm the creation of a MySQL user, and directory:/data//data/mysql
The error that appears in the following:
[Email protected]/usr/local/mysql#./bin/mysqld--defaults-file=/etc/my.cnf--initialize--user=mysql
./bin/mysqld:error while loading shared libraries:libaio.so.1:cannot open Shared object file:no such file or directory

Workaround:

[[email protected] data]# yum install-y Libaio//After installation, the initialization is OK.

9, with echo $? Check the previous step for errors,
10. Initialization complete, to copy the configuration file and startup script: The configuration file under: Support-files, Copy to/etc/and renamed to MY.CNF:CP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF////etc /MY.CNF there is a default my.cnf can be directly inside the change.

11. Copy startup script: CP Support-files/mysql.server/etc/init.d/mysqld
and modify:
Basedir=/usr/local/mysql the specified directory
Datadir=/data/mysql
Modified to change the/etc/init.d/mysqld to 755 permissions,

12. Want it to boot, put it in the system service list
Chkconfig--add mysqld
Then look at the View list of services: Chkconfig--list We can see that the MYSQLD service is inside, indicating that the next boot will start automatically, or you can start it directly with the command:
1?/etc/init.d/mysqld start can also be used with service mysqld start and can be started with the command line:/usr/local/mysql/bin/mysqld_safe--defaults-file=/etc /MY.CNF--user=mysql--datadir=/data/mysql &
Description
--datadir-file=/etc/my.cnf specifying the configuration file path
--user=mysql Specifying the Startup user
--datadir=/data/mysql/Specifying DataDir Path

(Modify the configuration file/etc/my.cnf, be sure to reinitialize it.)
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
Initialize mysql_install_db and start mysqld successfully)

13. See the process: PS aux |grep mysqld, look at the port it listens to: NETSTAT-LNTP
14, how to close Mysqld:killall mysqld (relatively safe), can not directly kill PID
You cannot force a kill process directly with kill-9, so it is easy to lose data and damage your table. You run out of Killall mysqld, and then you wait.
15?mysqld commonly used engines: InnoDB and MyISAM

Lamp, MySQL architecture introduction and MySQL installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.