Use the liunx Service (mysql database installation and the legendary LAMP installation [Forum building ])

Source: Internet
Author: User
Tags apache php


First, let's explain the differences between the source code package and the rpm package. Although it is not comprehensive, it is absolutely correct.


Differences between the source code package and the rpm package for mysql Installation

1. linux operating efficiency. Many functional modules are developed for linux. On ipvs, there is no standardized programming interface, and many functions cannot be implemented,

Mysql apache php was first developed on linux and has many third-party software.


2. The software selection is not necessarily the latest and should be the most stable

Rpm and source code

Rpm is a binary package generated by developers after the software is released. It is similar to an exe file. However, you cannot customize the linux version for the cpu platform.

The source code package is released in the form of source code. The software is well known and can be further customized even by modifying the source code.



-----------------------------------------------

Install the source code package during Forum setup


Source code Installation Process

Install Mysql source code package

Tar-zxvf mysql-5.1.34.tar.gz-C/usr/local/src/

Cd/usr/src/mysql-5.1.34

If a mysql user does not exist, create

Useradd mysql


Compile and install

./Configure -- prefix =/usr/local/mysql -- with-extra-charsets = all -- with-innodb -- with-plugins = partition

Note:

-- With-extra-charsets = all: all character sets are supported.

-- With-innodb: innodb Storage engine supported

-- With-plugins = partition: partitions are supported.



Make & make install



Database initialization:

Cd/usr/local/mysql/bin

Run

./Mysql_install_db


This command is an initialization script to prepare for Mysql running: to create a MySQL license table.

When this command is successfully executed, the var directory is generated under the/usr/local/mysql directory. If the command fails to be executed, the mysql user may not be created. You need to manually create useradd mysql,

Then uninstall the system mysql: rpm-e mysql.

Cd/usr/local/

Chown-R mysql: mysql/

Cd/usr/local/mysql/bin/


Change my. cnf name because the new database does not have any files. This is the previous file)

Mv/etc/my. cnf/etc/my. cnf. bak


Location of the rpm database creation

Cd/var/lib/mysql/

Location of the source code package

Cd/usr/local/mysql/var/



Initialize Database Change permissions

Chown-R mysql: mysql/usr/local/mysql/var/


Start mysql server. Run

Cd/usr/local/mysql/bin/

./Mysqld_safe -- user = mysql &


View Processes

Ps-ef | grep mysql



The set of character files is

Connection between processes



Add a password to the mysql database

The default mysql user already has a root user. The password is blank.


/Usr/local/mysql/bin/mysqladmin password 123 create a password

/Usr/local/mysql/bin/mysql-u root-p123 can be accessed, And/bin/mysql is used for exit logon.




Change the source code mysql to the normal startup mode and put the startup script in init. d)

When cp/usr/local/mysql/share/mysql. server/etc/init. d/mysqldd is set to startup phase, share/mysql. server is used.


Chkconfig -- add mysqldd

Chkconfig -- list mysqldd

Chkconfig -- levels 35 mysqld on

Service mysqldd restart




Client commands

Modify the/etc/bashrc File


PATH =/usr/local/mysql/bin: $ PATH

Export PATH


Reload once

./Etc/bashrc has a space to note. You can also write it in bash/etc/bashrc.


Data can be connected.




------------------------------------





Install apache source package

Tar-jxvf httpd-2.2.11.tar.bz2-C/usr/local/src/

Cd/usr/local/src/httpd-2.2.11/


./Configure -- prefix =/usr/local/apache2 -- enable-so -- enable-rewrite


Make & make install


Cd/usr/local/apache2/htdocs/Webpage path


Lsof-I: 80 check whether port 80 is occupied


/Usr/local/apache2/bin/apachectl start the service


Cp bin/apachectl/etc/init. d/http settings start


Configuration file configuration information

Vim/usr/local/apache2/conf/httpd. conf



Command history

History


--------------------------------------------



Compile php



Tar-jxvf php-5.2.9.tar.bz2-C/usr/local/src/

Cd/usr/local/src/php-5.2.9/


. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql -- with-config- file-path =/usr/local/php

. /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/hanqinet/mysql51/-- with-config -file-path =/usr/local/php

Note:

-- With-apxs2 =/usr/local/apache2/bin/apxs: Use apache's apxs tool to compile php into a module of apache

-- With-mysql =/usr/local/mysql: Combined with mysql


Compile and install

Make & make install


Copy a file

Cp/usr/local/src/php-5.2.9/php. ini-dist/usr/local/php. ini name defined by yourself


If everything goes well, apache2/modules/should have a libphp5.so file.

Add php support for apache


Edit

/Usr/local/apache2/conf/httpd. conf


Add a row in row 310

307 AddType application/x-compress. Z

308 AddType application/x-gzip. gz. tgz

309 AddType application/x-httpd-php. php



Last of the DirectoryIndex command,

Add

165 <IfModule dir_module>

166 DirectoryIndex index.html index. php

167 </IfModule>



Test Apache and php support

Cd/usr/local/apache2/htdocs/

Touch a. php

Vim a. php

<? Phpinfo ()?>


Pkill httpd: Kill the previous httpd

Service http restart service


Access

Http: // 192.168.1.113/a. php


-----------------------------------------

Server

Unzip UCenter_1.5.0_ SC _UTF8.zip

Mv upload // usr/local/apache2/htdocs/ucenter

Chown-R daemon: daemon/usr/local/apache2/htdocs/ucenter


Access

Http: // 192.168.1.113/ucenter


-------------


Forum

Unzip Discuz_7.2_ SC _UTF8.zip

Mv upload // usr/local/apache2/htdocs/discuz

Chown-R daemon: daemon/usr/local/apache2/htdocs/discuz

The first time you enter the installation path

Http: // 192.168.1.113/discuz/install/



------------------------------------


Finally, let's talk about mysql. If you are interested in mysql, let's take a look at it. I admit it's not my description of mysql ). However, to help you better understand mysql

Or add it.


Introduction to other databases in mysql

Mysql is an open-source, free, small-sized, and concurrently executed database. Mysql is generally enough for applications, and it still needs to be upgraded in terms of exception handling. It is used for website design and small software. PHP + mysql is hailed as a perfect combination.

SQL server is Microsoft Data, which is easy to use and simple and suitable for beginners. It is generally used in. net programming.


Oracle is a large database with a large volume. It supports running multiple instances at the same time and is very powerful.



Mysql in linux can make full use of its power free cross-platform light support for multi-concurrency)


Mysql is currently the most popular cross-platform open source relational database software. It was first developed by mysqlAB in Sweden.

Sun was acquired in, and sun was acquired by oracle in.

Because of the small size of mysql 150 M oracle 900 M fast overall cost low free oracle20 just in case of a single core) in particular, the open source code feature makes it a database that many small and medium websites choose to reduce the overall cost of their websites.


Advantages

1. Use c and c ++ to ensure source code portability

2. Supports various operating systems such as linx, mac OS, freeBSD, S, and aix...

3. provides APIs for multiple languages, including C ++ java php ...)

4. multithreading is supported to make full use of cpu resources

5. Supports multiple data connection methods, such as TCP/IP, ODBC, and JDBC.

6. Large data with over 10 million records can be processed

7. Support for multiple storage engines

Disadvantages

Compared with oracle DB2 SQLserver

Small Scale and limited functions (mysql cluster has poor functions and efficiency)


Storage Engine

The default database of MyISAMMysql is the most commonly used. High insertion and query speed, but not transactions


The preferred engine for InnoDB Transaction-type databases. It supports ACID transactions and row-level locking.


BDB is derived from Berkeley DB. It is another choice for transactional databases. It supports other transaction features such as COMMIT and ROLLBACK.


All Memory data is stored in the Memory storage engine, with extremely high insertion, update, and query efficiency. However, memory space is directly proportional to the data volume. And the content will be lost when Mysql is restarted.


Merge combines a certain number of MyISAM tables into a whole, which is useful in ultra-large-scale data storage.


Archive is ideal for storing a large number of independent historical data. Because they are not frequently read. Archive has an efficient insert speed, but its query support is relatively poor.


The Cluster/NDB high-redundancy storage engine provides services with multiple data machines to improve overall performance and security. Suitable for applications with large data volumes, high security and performance requirements


The storage engine BlackHole black hole engine, which logically separates data by commas (,) in CSV files. Any written data disappears and is generally used to record the relay of binlog replication.


The EXAMPLE storage engine is a stub engine that does nothing. It is used as an example of MySQL source code to demonstrate how to write a new storage engine.

Similarly, it is mainly interested in developers. The EXAMPLE storage engine does not support indexing.


Disable selinux and iptables

Selinux is a linux service for file and function management.




This article is from the "history_xcy" blog, please be sure to keep this http://historys.blog.51cto.com/7903899/1296697

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.