20151018 Job---MariaDB, compiling lamp and Samba

Source: Internet
Author: User
Tags bz2 fpm mysql client

Part I: MARIADB Basic Summary

1. Basic

A:MARIADB for C/s architecture: same host based on Unix Sock, different host based on TCP/IP, listening on port 3306

B: Configuration file:/etc/my.cnf----/etc/mysql/my.cnf-----~/.MY.CNF is configured with the highest priority

C:mysql Client Login

-U USERNAME: The account used to connect to the server; admin is root; (non-OS)
-H HOSTNAME or IP: Connected server
-P PASSWORD: The password of the user specified earlier with the-u option;

D: Mounting method

Source

Universal binary: Run directly after decompression

Package Manager

2. Table Management

Includes DDL and DML Two, where DDL includes creating, modifying, deleting databases, DML including adding, deleting, checking, and changing the corresponding table

A: Create A table:

View Help files by helping create table

CREATE TABLE [IF not EXISTS] Tbl_name (col1 type1 dec1, col2 type2 dec2, ...)

Example: Create TABLE test.techers (tid int unsigned not NULL Auto_increment primary key,
Name varchar () not null,age tinyint unsigned,gender enum (' F ', ' m ') default ' m ',
Echeng varchar (+), unique key (Name,kecheng));

B: Delete table: drop table Delete Tables

C: Query

SELECT
[DISTINCT] #去重
[Sql_cache | Sql_no_cache]
Col_name as Alias, Col_name as Alias, ...
[From Table_references
[WHERE Where_condition]
[ORDER by {col_name | expr | position}
[ASC | DESC], ...]

Restrictions:

Conditional expression after where:
, <, >=, <=, = =,! =
Between ... And ...
Like ' pattern '
_
%
Rlike ' pattern '

Example: SELECT * from test.techers where name Rlike ' ^[a-m].*i.*$ '

Use regular expressions to query for names that begin with a sub-parent A to Z

D: Insert:

INSERT [into] tbl_name [(Col_name,...)] {VALUES | VALUE} ({expr | DEFAULT},...), (...),...

Requires the same number of fields before and after

Example:

Insert into Test.techers (Name,age,classid,gender,kecheng) VALUES (' Emily ', 18,119, ' f ', ' Tulongdao ');

E: Modify: Alter TABLE

Change table field, name, etc.
Modify can only fix field definitions, cannot modify names

Example: Alter TABLE test.techers add ClassID smallint UNSIGNED not null after name;

F: Modify Data Update

UPDATE:
UPDATE table_reference
SET col_name1={expr1| DEFAULT} [, col_name2={expr2| DEFAULT}] ...
[WHERE Where_condition]
[ORDER by ...]
[LIMIT Row_count]

Example: Update test.techers set age=20 where tid = 1; #修改tid为1的年龄

3. Index management

A: Create an index

CREATE [unique| Fulltext| SPATIAL] INDEX index_name on tbl_name (Index_col_name,...)

B: Delete Index

DROP INDEX index_name on Tbl_name

4. User Rights Management

A: Authorization: If the user does not exist beforehand, create this account and authorize

GRANT Priv1,... On Db_name.tbl_name to ' username ' @ ' host ' [identified by [PASSWORD] ' PASSWORD '];

Example: Grant all on test.* to ' wpuser '% '; #表示text库中所有表

Use show grants [for user] to view acquired permissions

Example: Show grants for ' wpuser ' @ '% ';

B: Reclaim Permissions

REVOKE Priv1,... On Db_name.tbl_name from ' username ' @ ' host ';

Example:

#revoke insert,update on test.* from ' wpuser '% ';
Retract the INSERT, update permissions for all tables in Wpuser in the test library

The second part: Compile and install lamp, which respectively realizes

(1) Compile PHP into a httpd module

First step: Compile and install HTTPD24

1, temporary original httpd service, respectively, using Yum and FTP installation

Yum installation Pcre-devel Zlib-devel

Yum Groupinstall "Development Tools" "Server Platform Development" –y

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/74/a9/wkiom1yloirigdataadx4s0i9ea179.jpg "width=" 431 "height=" 157 "/>

APR-1.5.0.TAR.BZ2 apr-util-1.5.3.tar.bz2 httpd-2.4.9.tar.bz2

2, in order to install

Install apr-1.5.0.tar.bz2 First

Then apr-util-1.5.3.tar.bz2

And finally the httpd-2.4.9.tar.bz2.

A: Unzip the installation Apr

./configure--PREFIX=/USR/LOCAL/APR Directory #该目录为新指定目录防止与原安装冲突

650) this.width=650; "title=" clip_image001 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image001" src= "http://s3.51cto.com/wyfs02/M00/74/A9/wKiom1YloI_BL-a_AACBb9Ce580217.jpg" height= "137"/>

Run make && make install after configuration

650) this.width=650; "title=" clip_image002 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image002" src= "http://s3.51cto.com/wyfs02/M01/74/A9/wKiom1YloJCjo5J5AABTUl8lzNg621.jpg" height= "/>"

B: Install apr-util-1.5.3.tar.bz2

650) this.width=650; "title=" clip_image003 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image003" src= "http://s3.51cto.com/wyfs02/M02/74/A9/wKiom1YloJGRnDI8AABuFS4f96A579.jpg" height= "/>"

./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr #利用with-apr Specify new Apr path

650) this.width=650; "title=" clip_image004 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image004" src= "http://s3.51cto.com/wyfs02/M00/74/A9/wKiom1YloJKzsBt9AAA_sRkRt1A558.jpg" height= "/>"

Installation complete run make && make install

650) this.width=650; "title=" clip_image005 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "clip_image005" src= "http://s3.51cto.com/wyfs02/M01/74/A9/wKiom1YloJPgtQPQAAB5SwI_4Iw471.jpg" height= "138"/>

C: Install httpd

Run the following script

./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd24--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--with-zlib--with-pcre--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/-- Enable-moudles=most--enable-mpms-shared=all--with-mpm=prefork

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/74/A9/wKiom1YloJSRFRDqAAAnNPAt1E8280.jpg "height="/>

Run make && makes install at the same time

D: Configuration and verification

1. Apachectl Path

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/74/A9/wKiom1YloJThMQ1lAAAr7rGv3as524.jpg "height="/>

2. Run Apachectl start service

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/74/A9/wKiom1YloJXCddEyAAAzIXxH3U0035.jpg "height="/>

3. Follow-up configuration/etc/httpd24/httpd.conf master configuration file

Step Two: Install MARIADB

1. Stop the original MySQL service

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/74/A9/wKiom1YloJbjBzEnAAAvUXwvMkI291.jpg "height="/>

2, create a new file system, MyData directory

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/74/A9/wKiom1YloJeB_iSsAABmTzleKiw534.jpg "height=" 136 "/>

3, the next mariadb-5.5.40-linux-x86_64 decompression/usr/local directory

Create a soft connection ln–sv mariadb-5.5.40-linux-x86_64 MySQL

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/74/A5/wKioL1YloMCABbouAACI1y72C6k719.jpg "height=" 151 "/>

4. Uninstall the original MySQL

Yum Remove Mysql-server MySQL

5. Modify permissions mysql user and MySQL user group

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/74/A5/wKioL1YloMHREzHfAABBD8sbHlI279.jpg "height=" "/>"

6. Copy the configuration file according to the environment, create the/etc/mysql directory before copying

650) this.width=650; "title=" clip_image002[4] "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "Clip_image002[4]" src= "http://s3.51cto.com/wyfs02/M02/74/A5/wKioL1YloMLxorAYAAA8NJt3eDc424.jpg" height= "67"/ >

7. Compiling MySQL Library

scripts/mysql_install_db--user=mysql--datadir=/data/mydata/

650) this.width=650; "title=" clip_image002[6] "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "Clip_image002[6]" src= "http://s3.51cto.com/wyfs02/M00/74/A5/wKioL1YloMOhLj8kAABXZU9TcK0543.jpg" height= "106"/ >

8, /etc/mysql/my.cnf in datadir=/data/mydata

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/74/A9/wKiom1YloJuwFvSSAAB0Y5UgbS4106.jpg "height=" 189 "/>

9, modify the environment variable /etc/rc.d/init.d/mysqld, start MySQL

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/74/A9/wKiom1YloJygapfYAABsBKOhmcw723.jpg "height="/>

Step three: Install and compile PHP

1. Additional installation via Yum install: Libxml2-devel, Libmcrypt-devel, Bzip2-devel

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/74/A9/wKiom1YloJ3zn8jhAABXVEKrU0s257.jpg "height="/>

2, php-5.4.42.tar.bz2 to compile and install

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/74/A9/wKiom1YloJ6zy3qdAAC0dS2yC_c761.jpg "height=" 221 "/>

3. Make && make install

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m00/74/a5/wkiol1ylomisokb1aaexngd2l_e992.jpg "height=" 254 "/>

4. Copy the php.ini.production to /etc/php directory from the configuration directory

The time zone will be modified

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/74/A9/wKiom1YloKCR4EQ2AABCnP6WI9k794.jpg "height=" 109 "/>

5, edit the/etc/httpd24/httpd.conf file, load the corresponding module

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/74/A9/wKiom1YloKGTxqzcAACBei4IK0s734.jpg "height=" 163 "/>

6. Edit the/etc/httpd24/httpd.conf file

Add the following

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/AA/wKiom1YlpeWDT0SoAACMI30eTLY463.jpg "title=" 1.JPG " alt= "Wkiom1ylpewdt0soaacmi30etly463.jpg"/>

Also add in the index section

DirectoryIndex index.php index.html

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/A5/wKioL1YloMqgVwEUAACIptk6SAY971.jpg "height=" 127 " alt= "Wkiol1ylomqgvweuaaciptk6say971.jpg"/>

7. Reload the test page

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/A6/wKioL1YlpivRvWdPAABBbRWXzes888.jpg "title=" 2.JPG " alt= "Wkiol1ylpivrvwdpaabbbrwxzes888.jpg"/>

8. Configure PHP to communicate with MySQL

Edit the index.php file in the/usr/local/apache/htdocs/directory

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/A6/wKioL1YlpnLCyUI0AAA1_yhoEak701.jpg "title=" 3.JPG " alt= "Wkiol1ylpnlcyui0aaa1_yhoeak701.jpg"/>

Test

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/AA/wKiom1YlplaQWf8vAABEEpfnW0c797.jpg "title=" 4.JPG " alt= "Wkiom1ylplaqwf8vaabeepfnw0c797.jpg"/>

9, follow-up can use the AB tool for the corresponding test

Can be divided into dynamic and static two kinds of ways

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/A6/wKioL1YlppKgfVjfAABH4bRkLw8987.jpg "title=" 5.JPG " alt= "Wkiol1ylppkgfvjfaabh4brklw8987.jpg"/>

(2) PHP as an independent daemon with FPM workers

The difference between PHP and the standalone daemon is that it exists in a separate form, where the difference is in the compile-time parameter tuning. Before

Content is the same. This is not explained here, followed from the start of the compilation (the difference is-ENABLE-FPM)

1, delete the original php5.4.42 extract directory, re-unzip, run the script to re-

./configure--prefix=/usr/local/php5--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=

/usr/local/mysql/bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png

-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets --enable-fpm --with-mcrypt--

With-config-file-path=/etc--WITH-CONFIG-FILE-SCAN-DIR=/ETC/PHP.D--with-bz2

2. Compile to finish make && make install

3. Modify the configuration file

# CP Php.ini-production/etc/php.ini

Configure PHP-FPM

Provide the SYSV init script for php-fpm and add it to the list of services:

# CP SAPI/FPM/INIT.D.PHP-FPM/ETC/RC.D/INIT.D/PHP-FPM

# chmod +X/ETC/RC.D/INIT.D/PHP-FPM

# chkconfig--add php-fpm

# Chkconfig PHP-FPM on

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/A9/wKiom1YloKKwFdTxAAFIV_Cc_9c337.jpg "height=" 195 " alt= "Wkiom1ylokkwfdtxaafiv_cc_9c337.jpg"/>

4. Edit Php-fpm.conf

Main modified PID =/usr/local/php5/var/run/php-fpm.pid

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/A6/wKioL1YlpvPBApqlAABfCdsM6wg025.jpg "title=" 6.JPG " alt= "Wkiol1ylpvpbapqlaabfcdsm6wg025.jpg"/>

5. Start verification

Starting with service PHP-FPM start

PS aux | grep php-fpm

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/A6/wKioL1YlpwPBUoKlAAAp3s5Y0rg552.jpg "title=" 7.JPG " alt= "Wkiol1ylpwpbuoklaaap3s5y0rg552.jpg"/>

Simultaneous use of Netstat–tnlp|grep php-fpm, monitoring on port 9000

6, Configuration fastcgi

Modify/etc/httpd24/httpd24.conf

Enable the following two modules

LoadModule proxy_modulemodules/mod_proxy.so

LoadModule proxy_fcgi_modulemodules/mod_proxy_fcgi.so


Configure agents

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/AA/wKiom1YlpxyQcMj-AABYQ-kz3qM269.jpg "title=" 9.JPG " alt= "Wkiom1ylpxyqcmj-aabyq-kz3qm269.jpg"/>

7, start the verification, using the AB tool for the corresponding

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/A6/wKioL1Ylp4PSEtxzAABR-Z6xY5w925.jpg "title=" 10.JPG "alt=" Wkiol1ylp4psetxzaabr-z6xy5w925.jpg "/>

Part III:

20151018 Job---MariaDB, compiling lamp and Samba

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.