MySQL Lamp configuration Command Summary

Source: Internet
Author: User
Tags install php mcrypt create database phpmyadmin

Three Mysql
1. Uninstalling the MySQL RPM package
RPM-E MySQL--nodeps
2. Install the CMake package
Tar zxf cmake-2.8.6.tar.gz
CD cmake-2.8.6
./configure
Gmake && gmake Install
3. Create database program accounts and groups
Groupadd MySQL
Useradd-m-s/sbin/nologin mysql-g MySQL
4. Compile and install MySQL
(1) Decompression: Tar zxf mysql-5.5.22.tar.gz-c/usr/src/
(2) Configuration: cd/usr/src/mysql-5.5.22/
CMake
-dcmake_install_prefix=/usr/local/mysql (Note: MySQL installation directory)
-DSYSCONFDIR=/ETC (Note: MySQL configuration file path)
-ddefault_charset=utf8 (Note: Character set)
-ddefault_collation=utf8_general_ci
-dwith_extra_charsets=all
(3) Compile: Make
(4) Install: Make install
5. Post-Installation adjustments
[[email protected] ~]# chown-r mysql:mysql/usr/local/mysql (Note: Change the MySQL installation directory owner, belong to the group)
[[email protected] mysql-5.5.22]# CP support-files/my-medium.cnf/etc/my.cnf (note: Copy mysql config file)
[Email protected] mysql-5.5.22]#/usr/local/mysql/scripts/mysql_install_db
--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/(Note: initializing the database)
[[email protected] mysql-5.5.22]# echo "path= $PATH:/usr/local/mysql/bin" >>/etc/profile (Note: Add environment variable)
[Email protected] mysql-5.5.22]#. /etc/profile (Note: Refresh environment variable)
6. Registering as a system service
CP Support-files/mysql.server/etc/rc.d/init.d/mysqld
chmod +x/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
7. Start the service
Service mysqld Start
8. Set the password for the database user
Mysqladmin-u root [-p] Password new password

Four LAMP
1. Uninstalling PHP
rpm-e PHP--nodeps
2. Install the Encryption tool
Data encryption Tools Libmcrypt, Mhash, MCrypt
(1) Installation Libmcrypt
Tar zxf libmcrypt-2.5.8.tar.gz-c/usr/src/
cd/usr/src/libmcrypt-2.5.8/
./configure
Make && make install
Ln-s/usr/local/lib/libmcrypt./usr/lib/
(2) Installation Mhash
Tar zxf mhash-0.9.9.9.tar.gz-c/usr/src/
cd/usr/src/mhash-0.9.9.9/
./configure
Make && make install
Ln-s/usr/local/lib/libmhash
/usr/lib/
(3) Installation MCrypt
Tar zxf mcrypt-2.6.8.tar.gz-c/usr/src/
cd/usr/src/mcrypt-2.6.8/
Export Ld_library_path=/usr/local/lib: $LD _library_path
./configure
Make && make install
3. Install PHP
Tar zxf php-5.3.28.tar.gz-c/usr/src/
cd/usr/src/php-5.3.28/
./configure--PREFIX=/USR/LOCAL/PHP5
--with-mcrypt--with-apxs2=/usr/local/httpd/bin/apxs
--with-mysql=/usr/local/mysql--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP5
--enable-mbstring
Make
Make install
4. configuration file/usr/local/php5/php.ini adjustment
(1) Copy Template: Cp/usr/src/php-5.3.28/php.ini-development/usr/local/php5/php.ini
(2) Modify configuration: Vim/usr/local/php5/php.ini
Default_charset = "Utf-8"
File_uploads = On
Upload_max_filesize = 2M
Max_file_uploads = 20
Post_max_size = 8M
Short_open_tag = On
(3) Add Zend Optimization module
Tar zxf zendguardloader-php-5.3-linux-glibc23-x86_64.tar.gz-c/usr/src/
cd/usr/src/zendguardloader-php-5.3-linux-glibc23-x86_64/php-5.3.x/,
CP zendguardloader.so/usr/local/php5/lib/php/
Vim/usr/local/php5/php.ini
Zend_extension=/usr/local/php5/lib/php/zendguardloader.so
Zend_loader.enable=1
5.apache Configuration file Modification
Vim/usr/local/httpd/conf/httpd.conf

    LoadModule php5_module   modules/libphp5.so    (注:如果正常,则自动填写)    AddType application/x-httpd-php .php          (注:需要个人添加)    DirectoryIndex index.php index.html

6. Restart Apache
/usr/local/httpd/bin/apachectl restart

7. Test whether PHP displays correctly
vim/usr/local/httpd/htdocs/test1.php
<?php
Phpinfo ();
?>
8. Test the database for normal access
vi/usr/local/httpd/htdocs/test2.php
<?php
$link =mysql_connect (' localhost ', ' root ', ' 123456 ');
if ($link) echo "Congratulations, the database connection is successful!! ";
Mysql_close ();
?>

9. Configuring the phpMyAdmin Database Management Suite
(1) Unpack and copy to site Directory
Tar zxf phpmyadmin-4.2.5-all-languages.tar.gz
MV Phpmyadmin-4.2.5-all-languages//usr/local/httpd/htdocs/phpmyadmin
(2) Setting up the configuration file config.inc.php
Cd/usr/local/httpd/htdocs/phpmyadmin
CP config.sample.inc.php config.inc.php
(3) In the browser access/HTTP/domain or ip/phpmyadmin/

MySQL Lamp configuration Command Summary

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.