这篇文章将为大家详细讲解有关如何进行mysql的安装配置以及测试,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
mysql
1. mysql安装
(1)tar zxf mysql-boost-5.7.17.tar.gz
(2)yum install cmake-2.8.12.2-4.el6.x86_64.rpm -y
cd mysql-5.7.17/
(3)cmake-DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql-DMYSQL_DATADI=/usr/local/lnmp/mysql/data-DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock-DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_NGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_BOOST=boost/boost_1_59_0/
(4)根据报错依次安装需要的包,没有错误之后执行下一步
(5)myaqlMake && make install
2.Mysql 配置
[root@server1 mysql-5.7.17]# groupadd -g 27 myaql
[root@server1 mysql-5.7.17]# useradd -u 27 -g 27 -s /sbin/nologin -M -d /usr/local/lnmp/mysql/ mysql
[root@server1 mysql-5.7.17]# id mysql
uid=27(mysql) gid=27(myaql) groups=27(myaql)
[root@server1 mysql-5.7.17]# cd /usr/local/lnmp/mysql/
[root@server1 mysql]# chown mysql.mysql . -R
[root@server1 mysql]# cd support-files/
[root@server1 support-files]# ls
magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server
[root@server1 support-files]# ll /etc/my.cnf
-rw-r--r--. 1 root root 251 Aug 9 2013 /etc/my.cnf
[root@server1 support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
[root@server1 support-files]# cp mysql.server /etc/init.d/mysqld
[root@server1 mysql]# mysqld --initialize --user=mysql ##进行初始化
[root@s erver1 mysql]# chown root.root . -R
[root@server1 mysql]# chown mysql data -R
[root@server1 mysql]# ll
[root@server1 mysql]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/usr/local/lnmp/mysql/data/server1.err'.
SUCCESS!
[root@server1 data]# mysql_secure_installation ##密码设置由大小写数字符号组成
3..php安装
Tar zxf php-5.6.20.tar.bz2
Cd php-5.6.20
./configure--prefix=/usr/local/lnmp/php --with-config-file-path=/usr/local/lnmp/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gmp --with-gettext --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-fpm --enable-mbstring --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash
随着提示安装所需要的包
yum install libmcrypt-2.5.8-9.el6.x86_64.rpm libmcrypt-devel-2.5.8-9.el6.x86_64.rpm -y
yum install libxml2-devel -y
yum install -y bison
yum install curl-devel freetype-devel gmp-devel net-snmp-devel -y
yum install re2c-0.13.5-1.el6.x86_64.rpm -y
yum provides */png.h
yum install -y libpng-devel-1.2.49-1.el6_2.x86_64
yum provides */jpeglib.h
yum install libjpeg-turbo-devel -y
Make && make install
4.php配置
[root@server1 ~]# cd php-5.6.20
[root@server1 php-5.6.20]# cd sapi/
[root@server1 sapi]# cd fpm/
[root@server1 fpm]# file init.d.php-fpm
init.d.php-fpm: POSIX shell script text executable
[root@server1 fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@server1 fpm]# chmod +x /etc/init.d/php-fpm
[root@server1 fpm]# cd /usr/local/
[root@server1 local]# cd lnmp/php/etc/
[root@server1 etc]# vim php.ini
[root@server1 etc]# cp php-fpm.conf.default php-fpm.conf
[root@server1 etc]# vim php-fpm.conf
[root@server1 etc]# /etc/init.d/php-fpm start
Starting php-fpm done
[root@server1 etc]# vim ~/.bash_profile
[root@server1 etc]# source ~/.bash_profile
[root@server1 etc]# netstat -antlp | grep :9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1374/php-fpm
[root@server1 nginx]# ln -s /usr/local/lnmp/nginx/sbin/nginx /sbin/
[root@server1 conf]# vim nginx.conf
[root@server1 nginx]# nginx
[root@server1 nginx]# netstat -antlp | grep :80
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1418/nginx
[root@server1 html]# vim index.php
[root@server1 html]# /etc/init.d/iptables stop
测试:
5..论坛
[root@server1 ~]# unzip Discuz_X3.2_SC_UTF8.zip
[root@server1 ~]# mv upload/ /usr/local/lnmp/nginx/html/bbs
[root@server1 ~]# cd /usr/local/lnmp/nginx/html/bbs
[root@server1 bbs]# chmod 777 config/ data/ uc_client/ uc_server/ -R
[root@server1 local]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# vim php.ini
[root@server1 etc]# chmod 755 /usr/local/lnmp/mysql/data/
[root@server1 etc]# /etc/init.d/php-fpm reload
测试:
6.Memcache
[root@server1 ~]# tar zxf memcache-2.2.5.tgz
[root@server1 ~]# cd memcache-2.2.5
[root@server1 memcache-2.2.5]# phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@server1 memcache-2.2.5]# ./configure
[root@server1 memcache-2.2.5]# make && make install
[root@server1 no-debug-non-zts-20131226]# which php
/usr/local/lnmp/php/bin/php
[root@server1 etc]# cd /usr/local/lnmp/php/etc/
[root@server1 etc]# rpm -e `rpm -qa|grep php`
[root@server1 etc]# vim php.ini
[root@server1 etc]# /etc/init.d/php-fpm reload
Reload service php-fpm done
[root@server1 etc]# php -m |grep memcache
memcache
[root@server1 ~]# cd memcache-2.2.5
[root@server1 memcache-2.2.5]# yum install -y memcached
[root@server1 memcache-2.2.5]# /etc/init.d/memcached start
Starting memcached: [ OK ]
[root@server1 memcache-2.2.5]# cp example.php memcache.php /usr/local/lnmp/nginx/html/
[root@server1 memcache-2.2.5]# cd /usr/local/lnmp/nginx/html/
[root@server1 html]# ls
50x.html bbs example.php index.html index.php memcache.php
[root@server1 html]# vim memcache.php
[root@server1 html]# /etc/init.d/memcached reload
Stopping memcached: [ OK ]
Starting memcached: [ OK ]
测试:
7.openresty ##openresty是一个基于nginx的可伸缩web平台,使用lua并编写脚本,然后部署到ngnix web容器中运行,从而能更轻松开发出高性能的web服务
tar zxf openresty-1.11.2.3.tar.gz
cd openresty-1.11.2.3
./configure
Gmake && gmake install
cd /usr/local/openresty/nginx/conf/
vim nginx.conf
[root@server1 conf]# netstat -antlp | grep :11211
nginx -s reload
/etc/init.d/memcached reload
测试:
[kiosk@foundation1 ~]$ ab -c10 -n 5000 http://172.25.254.11/index.php
关于如何进行mysql的安装配置以及测试就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。