Liunx ubuntu Web apache2 + php + MySQL Installation

Source: Internet
Author: User

Ubuntu system under preparation phase update download source
apt-get update
Apache2 Installation
sudo apt-get install apache2

默认www目录在"var/www"下
安装目录/etc/apache2/

Launch Apache Service
/etc/init.d/apache2 start或sudo /etc/init.d/apache2 start
Restart Apache Service
/etc/init.d/apache2 restart或sudo /etc/init.d/apache2 restart
Stop Apache Service
/etc/init.d/apache2 stop或sudo /etc/init.d/apache2 stop
Port modification Apache
sudo vim /etc/apache2/ports.conf
Apache Configuration Modifications
sudo vim /etc/apache2/ports.conf
MySQL Installation
sudo apt-get install mysql-server
Apache2 and PHP configuration
sudo apt-get install libapache2-mod-php
PHP5.6 Installation
sudo apt-get install php5.6
PHP7.0 Installation
sudo apt-get install php7.0
php5.6 + MySQL Configuration
sudo apt-get install php5.6-mysql
See if MySQL starts the command
ps -aux | grep mysqld
See if MySQL is listening on the port command
netstat -tl | grep mysql

You will see something like the following to indicate the installation and startup success
TCP 0 0 : MySQL :* LISTEN

Extranet access MySQL
    1. MySQL user has permission to access in the external network
      After MySQL is installed, the default root can only be accessed under 127.0.0.1, and the extranet is inaccessible.
      Here's how to fix it:
      1. Modify the table, log in to the MySQL database, switch to the MySQL database, and use the SQL statement to view the "select Host,user from User;"

        mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = ‘%‘ where user =‘root‘;mysql>select host, user from user;mysql>flush privileges;

        Note: The last sentence is important in order for the changes to take effect. If you do not write, you still cannot connect remotely.

2, MySQL modify the configuration file, you can access the IP

修改bind-address  = 0.0.0.0

Reference Blog

3, Firewall restricted access to the port
4. Cloud Service Firewall restricted access

3. Debian/ubuntu Linux

1.启动:/etc/init.d/mysql start2.停止:/etc/init.d/mysql stop3.重启:/etc/init.d/mysql restart
About Bind-address

http://blog.csdn.net/chuck_perry/article/details/54907388

Linux has a lot of new versions of the software to split the configuration file, which is already a style, such as the environment variable configuration file/etc/profile has extended configuration folder/etc/ Profile.d,apache also, in addition to the main configuration file httpd.conf, http.conf also include CONF.D (do not know that there is no mistaken) directory under all the Conf end of the file, so you see the configuration file in the Include, You need to know what it means!
Finally, please feel that understanding also choose an answer, do not know the answer also hangs unanswered
1, use Find, locate and other commands to find all the my.cnf files. If there are multiple my.cnf, some are not loaded and only one is loaded.
2, if the real my.cnf file does not have the bind address, is your my.cnf did not write, the equivalent of comments out, you can write your own, and then restart MySQL.

(The following methods are not validated)Authorized user, you want root to connect to MySQL server from any host with password

GRANT all privileges on . To ' root ' @ '% ' identified by ' admin123 ' with GRANT OPTION;
Flush privileges;

If you want to allow user root to connect to a MySQL server from a host with IP 192.168.1.104

GRANT all privileges on . To ' myuser ' @ ' 192.168.1.104 ' identified by ' admin123 ' with GRANT OPTION;
Flush privileges;

Liunx ubuntu Web apache2 + php + MySQL Installation

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.