[iyunv@dba01 support-files]# ln -s /usr/local/mysql/bin/* /bin/
[iyunv@dba01 support-files]# /etc/init.d/mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL.......................... SUCCESS!
[iyunv@dba01 support-files]# netstat -lntp|grep mysqld
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 46116/mysqld
[iyunv@dba01 support-files]# mysqladmin -uroot password '123456'
[iyunv@dba01 support-files]# mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.5.19-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show engines; #查看mysql存储引擎
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+--------------------+---------+------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.00 sec)
mysql> show variables like 'innodb_version'G; #查看innodb存储引擎版本。
*************************** 1. row ***************************
Variable_name: innodb_version
Value: 1.1.8
1 row in set (0.00 sec)
mysql> show variables like 'log_error'; #查看mysql错误日志存放路径
+---------------+---------------------------+
| Variable_name | Value |
+---------------+---------------------------+
| log_error | /var/mysql/data/dba01.err |
+---------------+---------------------------+
1 row in set (0.00 sec)
mysql> system hostname; #查看mysql主机名
dba01
mysql> show create table mysql.slow_log; #查看mysql慢查询日志结构
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| slow_log | CREATE TABLE `slow_log` (
`start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`user_host` mediumtext NOT NULL,
`query_time` time NOT NULL,
`lock_time` time NOT NULL,
`rows_sent` int(11) NOT NULL,
`rows_examined` int(11) NOT NULL,
`db` varchar(512) NOT NULL,
`last_insert_id` int(11) NOT NULL,
`insert_id` int(11) NOT NULL,
`server_id` int(10) unsigned NOT NULL,
`sql_text` mediumtext NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' |
+----------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show variables like 'log_output'; #查看mysql慢查询的格式
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_output | FILE |
+---------------+-------+
1 row in set (0.00 sec)
mysql> set global log_output='TABLE';
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'log_output';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_output | TABLE |
+---------------+-------+
1 row in set (0.00 sec)
mysql> select sleep(10);
+-----------+
| sleep(10) |
+-----------+
| 0 |
+-----------+
1 row in set (10.00 sec)
mysql> q
Bye
#安装pcre
[iyunv@dba01 support-files]# cd
[iyunv@dba01 ~]# tar -zxvf pcre-8.31.tar.gz && cd pcre-8.31
[iyunv@dba01 pcre-8.31]# ./configure && make && make install
#安装Nginx
[iyunv@dba01 ~]# tar -zxvf nginx-1.2.7.tar.gz && cd nginx-1.2.7
[iyunv@dba01 nginx-1.2.7]# /usr/sbin/groupadd www
[iyunv@dba01 nginx-1.2.7]# /usr/sbin/useradd -g www www
[iyunv@dba01 nginx-1.2.7]# ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
[iyunv@dba01 nginx-1.2.7]# make && make install
[iyunv@dba01 ~]# /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
[iyunv@dba01 ~]# ln -s /lib64/libpcre.so.0 /lib64/libpcre.so.1
[iyunv@dba01 ~]# /usr/local/nginx/sbin/nginx
[iyunv@dba01 ~]# netstat -lntp|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 29508/nginx
[iyunv@dba01 ~]# /etc/init.d/iptables stop
#安装php
#备注:php5.3.3以后的版本源码不需要打php-fpm补丁,该补丁已经集成进5.3.3,在编译时,不需再--enable-fastcgi了,在php5.3.3中强制启用fastcgi.
[iyunv@dba01 nginx-1.2.7]# cd
[iyunv@dba01 ~]# tar -zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
[iyunv@dba01 libmcrypt-2.5.8]# ./configure && make && make install
[iyunv@dba01 libmcrypt-2.5.8]# cd
[iyunv@dba01 ~]# tar -zxvf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9
[iyunv@dba01 mhash-0.9.9.9]# ./configure && make && make install
[iyunv@dba01 mhash-0.9.9.9]# cd ..
[iyunv@dba01 ~]# tar -zxvf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8
config.status: executing default commands
[iyunv@dba01 mcrypt-2.6.8]# LD_LIBRARY_PATH=/usr/local/lib ./configure --prefix=/usr/local/
[iyunv@dba01 mcrypt-2.6.8]# make && make install
[iyunv@dba01 mcrypt-2.6.8]# cd ..
[iyunv@dba01 ~]# tar -zxvf libiconv-1.14.tar.gz
[iyunv@dba01 ~]# cd libiconv-1.14
[iyunv@dba01 libiconv-1.14]# ./configure && make && make install
[iyunv@dba01 libiconv-1.14]# cd
[iyunv@dba01 ~]# tar -xjvf eaccelerator-0.9.6.1.tar.bz2
[iyunv@dba01 ~]# cd eaccelerator-0.9.6.1
[iyunv@dba01 eaccelerator-0.9.6.1]# /usr/local/php/bin/phpize
[iyunv@dba01 eaccelerator-0.9.6.1]# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config && make && make install
[iyunv@dba01 eaccelerator-0.9.6.1]# cd ..
[iyunv@dba01 ~]# tar zxvf PDO_MYSQL-1.0.2.tgz
[iyunv@dba01 ~]# cd PDO_MYSQL-1.0.2
[iyunv@dba01 PDO_MYSQL-1.0.2]# /usr/local/php/bin/phpize
[iyunv@dba01 PDO_MYSQL-1.0.2]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql && make && make install && cd
[iyunv@dba01 ~]# cd memcached-1.2.5
[iyunv@dba01 memcached-1.2.5]# ./configure --prefix=/usr/local/memcache && make && make install && cd
[iyunv@dba01 ~]# tar -zxvf memcache-2.2.5.tgz
[iyunv@dba01 ~]# cd memcache-2.2.5
[iyunv@dba01 memcache-2.2.5]# /usr/local/php/bin/phpize
[iyunv@dba01 memcache-2.2.5]# ./configure --with-php-config=/usr/local/php/bin/php-config && make && make install && cd
[iyunv@dba01 ~]# sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#g" /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# mkdir -p /usr/local/eaccelerator_cache
[iyunv@dba01 ~]# sed -i '1290a [eaccelerator]' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1291a zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1292a eaccelerator.shm_size="64"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1293a eaccelerator.cache_dir="/usr/local/eaccelerator_cache"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1294a eaccelerator.enable="1"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1295a eaccelerator.optimizer="1"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1296a eaccelerator.check_mtime="1"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1297a eaccelerator.debug="0"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1298a eaccelerator.filter=""' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1299a eaccelerator.shm_max="0"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1300a eaccelerator.shm_ttl="3600"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1301a eaccelerator.shm_prune_period="3600"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1302a seaccelerator.shm_only="0"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1303a eaccelerator.compress="1"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '1304a eaccelerator.compress_level="9"' /usr/local/php/etc/php.ini
[iyunv@dba01 ~]# sed -i '58s###g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '59s###g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '63s###g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '66s###g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '63s#nobody#nginx#g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '66s#nobody#nginx#g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '79s#5#128#g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '113s#1024#20480#g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# sed -i '132s#500#1024#g' /usr/local/php/etc/php-fpm.conf
[iyunv@dba01 ~]# ulimit -SHn 65535
[iyunv@dba01 ~]# /usr/local/php/sbin/php-fpm
[iyunv@dba01 ~]# netstat -lntp|grep php-fpm
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 18005/php-fpm