Use the yum command in Centos to deploy the lamp environment _ MySQL

Source: Internet
Author: User
Use the yum command in Centos to deploy the lamp environment CentOSLAMP

BitsCN.com

1. by default, Centos enables the IP security policy, that is, port 80 also disables external access. Therefore, iptables is disabled first.

Service iptables stop

Or open to port 80.

Iptables-I RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT

2. install apache

Yum install httpd (only install apache). If you want to install other plug-ins, you can

Yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql

 

The webpage after installation is/var/www/html

3. install mysql

Yum install mysql-server mysql-devel

After the installation is complete, the following error may occur when running mysql: Can't connect to local MySQL server through socket '/var/lib/mysql. sock
There are many causes for this error. in this case, the mysql. sock file cannot be found in the/var/lib/mysql/directory and can be run.
Service mysqld start or (/etc/init. d/mysqld start)
If mysql is successfully started, mysql is generated in the/var/lib/mysql/directory. in the sock file, mysql is automatically started when the system is started. Otherwise, the error "Can't connect to local MySQL server through socket" is repeated. The automatic startup command is as follows:

Chkconfig mysqld on

The system does not set a password by default, that is, a blank password. if you want to set a mysql password, assume that the password is set to 123456.

Mysqladmin-u root password 123456

If you want to enable external access to mysql, you need to set the user to provide external access.

Mysql> grant all privileges on *. * TO 'username '@ 'address 'identified BY 'password' with grant option;
Mysql> flush privileges;

For example, the root user is allowed to connect with the 123456 password 192.168.6.6.

Mysql> grant all privileges on *. * TO 'root' @ '192. 168.6.6 'identified BY '20140901' with grant option;
Mysql> flush privileges;

For example, allow all external users to connect to the database with the root password 123456

Mysql> grant all privileges on *. * TO 'root' @ '%' identified by '000000' with grant option;
Mysql> flush privileges;

For example, the IP address 192.168.6.6 is allowed, and the USER root password 123456 is used to connect to the USER database.

Mysql> grant all privileges on user. * TO 'root' @ '%' identified by '000000' with grant option;
Mysql> flush privileges;

 

4. install php

Yum install php-mysql php-common php-gd php-mbstring php-mcrtpt php-devel php-xml

BitsCN.com

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.