Summary of lamp platform construction (1)

Source: Internet
Author: User

 

Figure-LAMP

LampPlatform Construction: linux + apache + mysql + PHP

1. Install mysql-5.1.36

Software acquisition:

Http://dev.mysql.com/downloads/

Installation steps:

Tar xvfz mysql-5.1.36.tar.gz

Cd mysql-5.1.36

./Configure-prefix =/usr/local/mysql \

-With-extra-charsets = all \

-Sysconfdir =/usr/local/mysql/etc \

-Localstatedir =/var/lib/mysql \

-With-unix-socket-path =/usr/local/mysql/var/mysql. sock \

-With-charset = gbk \

-With-collation = gbk_chinese_ci

(Loading gbk and gbk_chinese_ci can handle Chinese garbled characters)

Make

Make install

(Note. -localstatedir =/var/lib/mysql is added to/configure, but the mysql directory is not generated under/var/lib, therefore, after compiling and installing the source code package, check whether this directory exists. If not, manually create one: mkdir/var/lib/mysql)

Groupadd mysql

Useradd-g mysql-d/home/mysql-s/bin/bash-c "MySQL user" mysql

(To ensure security, we create a common user to initialize the database. The main directory of mysql is/usr/local/var, and this user cannot log on to the server .)

Cp/usr/local/mysql/share/mysql/my-large.cnf/etc/my. cnf

Cd/usr/local/mysql

./Bin/mysql_install_db-user = mysql

(Initialize the database. database files will be generated under/var/lib/mysql. This step is not required for upgrade .)

Chown-R root: mysql.

Chown-R mysql: mysql/var/lib/mysql

/Usr/local/mysql/bin/mysqld_safe &

(Start the server, & indicates running in the background. This command will not be used for subsequent startup. Use the mysql. server startup file in/usr/local/mysql/share/mysql/to start later .)

/Usr/local/mysql/bin/mysql-u root-p

(If there is no password, use/usr/local/mysql/bin/mysql)

Cp/usr/local/mysql/share/mysql. server/etc/init. d/mysql

Chmod 755/etc/init. d/mysql

Then you can run service mysql start, service mysql restart, or service mysql stop to start or stop the MySQL service. /Etc/init. d/mysql start is also supported.

Chkconfig mysql on

Chkconfig-add mysql

Chkconfig-level 345 mysql on

(Set to automatically start the MySQL service at startup)

Check whether port 3306 is Enabled:

Netstat-atln

Set the MySQL root Password (non-system root ):


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.