Install MySQL + Apache + PHP + phpMyAdmin in Linux

Source: Internet
Author: User

/////////////// Source code compilation and installation of MySQL:
Shell> groupadd MySQL
Shell> useradd-G MySQL
Shell> gunzip | mysql-VERSION.tar.gz | tar-xvf-
Shell> Cd mysql-version
Shell>./configure -- prefix =/usr/local/MySQL
Shell> make
Shell> make install
Shells> CP support-files/my-medium.cnf/etc/My. CNF
Shell> Cd/usr/local/MySQL
Shell> chown-r MySQL.
Shell> chgrp-r MySQL.
Shell> bin/mysql_install_db -- user = MySQL
Shell> chown-r root.
Shell> chown-r MySQL VaR
Shell> bin/mysqld_safe -- user = MySQL &

After the installation is successful, you will see a similar
[1] 3879
[Root -- 1014 --/usr/local/MySQL] Starting mysqld daemon with databases from/usr/local/MySQL/var
Such prompt information
You can also use PS-A | grep MySQL to check whether MySQL has been run in the background and whether it is successful. Of course, in/usr/local/MySQL/bin
Enter MySQL
Mysql> also indicates that MySQL is successfully installed.

To perform database operations under shell, you can directly enter the command without entering the/usr/local/MySQL/bin/directory. We recommend that you create the following link:
Ln-S/usr/local/MySQL/bin/mysqladmin/usr/bin
Ln-S/usr/local/MySQL/bin/MySQL/usr/bin

In addition, you need to manually restart MySQL after each computer restart installed by compiling the source code. Therefore, it is necessary to add MySQL to the service and
The startup items are as follows:
MV share/MySQL. Server/etc/init. d/MySQL
Chmod 775/etc/init. d/MySQL
Chkconfig -- add MySQL
(Note: 775 indicates rwx R-X, because r -- 4, w -- 2, X -- 1)

///////////////// Source code to install Apache
Shell>./configure -- prefix =/usr/local/Apache
Shell> make
Shell> make install
//
Ln-S/usr/local/Apache/bin/apachectl/usr/bin/
Start:
Shell> apachectl start
Test: enter 127.0.0.1. You can see that it works indicates that Apache is successfully installed.

//// // Install PHP
Shell>. /configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-mysql =/usr/local/MySQL -- With-mysqli = /usr/local/MySQL/bin/mysql_config
Shell> make
Shell> make install
Shell> cp php. ini-Dist/usr/local/lib/PHP. ini

Integration of PHP and Apache
Open/usr/local/Apache/CONF/httpd. conf
Configure Apache as follows:
# Set the site and Directory
DocumentRoot "/home/httpd/html/" # Set it by yourself
(Note: After you modify the default settings
<Directory/>
Options followsymlinks
AllowOverride none
Order deny, allow
Deny from all
</Directory>
Change "Deny from all" to "allow from all" in; otherwise, the forbidden error will occur when accessing the test page.
And modify
<Directory "/XXX"> "/XXX" is changed to the configured DocumentRoot)

 

# Set whether to allow index Directories
Options followsymlinks Multiviews

# Set the PHP file suffix
Addtype application/X-httpd-PHP. php. phtml. php3. inc
Addtype application/X-httpd-PHP-source. PHPs

# Set the default file name order of Apache
Directoryindex index. php index.shtml index.html index.htm

 

Shell> apachectl restart

/// // Test
Write a simple PHP File
Http: // 127.0.0.1/XX. php

 

//////////////////////////////////////// ////// PhpMyAdmin Installation

Decompress the source code and put it under DocumentRoot.

Configure the commands that may be used

CD phpMyAdmin
Mkdir config # create directory for saving
Chmod o + RW config # Give it world writable permissions

CP config. Inc. php config/# copy current configuration for editing
Chmod o + W config/config. Inc. php # Give it world writable permissions

 

Go to http: // xxx/PHPmyAdmin/scripts/setup. php to visually configure

 

 

During the configuration process, the system prompts every time you enter http: // xxx/phpMyAdmin.

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

Error. You can enter http: // xxx/PHPmyAdmin/index. php.

 

 
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.