杭州银行×TiDB:打造首个云原生分布式国产银行核心业务系统
609
2023-07-02
基于Nginx+PHP+MySQL怎么搭建VPS
目前nginx的worker_processes设置为4,php-fpm设置为dynamic模式,max_children=32,start_servers=8,min_spare_servers=4,max_spare_servers=16,max_request=512的环境下,540mb内存剩余380mb,相比之前用zend server ce搭建的lamp内存开销,优化效果还是十分明显的,而且网站速度也很理想,给我最大的感受就是页面请求的响应速度比以前大大提升了。鉴于mysql5.5.8这个新产品发布不久,网上的相关资料匮乏,补充一些自己在编译上的内容(注意,我因为自己对innodb无需求,因此屏蔽了innodb引擎,如果需要可以开启参数-dwith_innobase_storage_engine=1。
复制代码 代码如下:
#download software packagewget http://cmake.org/files/v2.8/cmake-2.8.3.tar.gzwget http://ftp.gnu.org/gnu/bison/bison-2.4.3.tar.gztar zxvf cmake-2.8.3.tar.gzcd cmake-2.8.3/./configure --prefix=/usrgmakegmake installcd ../tar zxvf bison-2.4.3.tar.gzcd cd bison-2.4.3./configuremakemake install#install mysql5.5.8/usr/sbin/groupadd mysql/usr/sbin/useradd -g mysql mysqlmkdir -p /data/mysqlchown -r mysql:mysql /data/mysqltar zxvf mysql-5.5.8.tar.gzcd mysql-5.5.8cmake . -dcmake_install_prefix=/usr/local/mysql -dmysql_datadir=/data/mysql -dwithout_innobase_storage_engine=1 -dwith_memory_storage_engine=1 -dwith_myisam_storage_engine=1 -dsysconfdir=/etc/ -dwith_ssl=yes -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci -dwith_readline=onmakemake install/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql --user=mysql#modify mysql configvim /etc/my.cnf[client]port = 3306socket = /tmp/mysql.sock[mysqld]port = 3306socket = /tmp/mysql.sockskip-external-lockingkey_buffer_size = 256mmax_allowed_packet = 1mtable_open_cache = 256sort_buffer_size = 1mread_buffer_size = 1mread_rnd_buffer_size = 4mmyisam_sort_buffer_size = 64mthread_cache_size = 8query_cache_size= 16mthread_concurrency = 1basedir = /usr/local/mysqldatadir = /data/mysqldefault-storage-engine = myisamlog-bin=mysql-binbinlog_format=mixedserver-id = 1[mysqldump]quickmax_allowed_packet = 16m[mysql]no-auto-rehash[myisamchk]key_buffer_size = 128msort_buffer_size = 128mread_buffer = 2mwrite_buffer = 2m[mysqlhotcopy]interactive-timeout#add to boot configcp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqldchkconfig --add mysqld/etc/rc.d/init.d/mysqld start/usr/local/mysql/bin/mysql -u root -p -s /tmp/mysql.sock
ps:如果在编译php的时候报错error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: no such file or directory,可以通过以下方法解决:
复制代码 代码如下:
ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。