您好,欢迎访问一九零五行业门户网

Linux下 MySQL 安装以及优化

系统环境:centos 6.5mysql版本:mysql-5.6.19.tar.gz软件上传路径:/doiido/soft 一、mysql安装1:防火墙打开相应端口# /sbin/
首页 → 数据库技术
背景:
阅读新闻
linux下 mysql 安装以及优化
[日期:2015-02-28]来源:linux社区 作者:doiido[字体:]
系统环境:centos 6.5
mysql版本:mysql-5.6.19.tar.gz
软件上传路径:/doiido/soft
一、mysql安装
1:防火墙打开相应端口
#  /sbin/iptables -i input -p tcp --dport 3306 -j accept
#  /etc/rc.d/init.d/iptables save
2:安装相关依赖包
#  yum -y install gcc gcc-c++ ncurses ncurses-devel openssl openssl-devel cmake perl lsof bison
3:删除自带的mysql
#  rpm -qa|grep mysql
#  rpm -e --allmatches --nodeps mysql-libs-5.1.71-1.el6.x86_64
4:创建相关目录
#  mkdir /doiido/soft
#  mkdir -p /doiido/mysql/data/
5:创建mysql用户
#  /usr/sbin/groupadd mysql
#  /usr/sbin/useradd -s /sbin/nologin -m -g mysql mysql
#  chown -r mysql:mysql /doiido/mysql/
6:安装mysql
#  cd /doiido/soft
#  tar -zxvf mysql-5.6.19.tar.gz
#  cd mysql-5.6.19
#  cmake -dcmake_install_prefix=/doiido/server/mysql -dmysql_datadir=/doiido/mysql/data -dwith_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=on
#  make && make install
7:修改相关目录权限并创建软连接
#  chmod +w /doiido/server/mysql
#  chown -r mysql:mysql /doiido/server/mysql/
#  ln -s /doiido/server/mysql/lib/lib* /usr/lib/
#  ln -s /doiido/server/mysql/bin/mysql /usr/bin
8:修改配置文件
#  cp /doiido/server/mysql/support-files/my-default.cnf /etc/my.cnf
#  vi /etc/my.cnf
[mysqld]
character-set-server = utf8
default-storage-engine = myisam
basedir = /doiido/server/mysql
datadir = /doiido/mysql/data
log-error = /doiido/mysql/mysql_error.log
pid-file = /doiido/mysql/mysql.pid
max_allowed_packet = 32m
explicit_defaults_for_timestamp = true
9:安装mysql数据库
#  /doiido/server/mysql/scripts/mysql_install_db --basedir=/doiido/server/mysql --datadir=/doiido/mysql/data --user=mysql
10:设置mysql开机自动启动服务
#  cp /doiido/server/mysql/support-files/mysql.server /etc/init.d/mysqld
#  chkconfig --add mysqld
#  chkconfig --level 345 mysqld on
11:修改mysqld文件并启动mysql
#  vi /etc/init.d/mysqld
#修改mysqld文件中的下面两项
basedir=/doiido/server/mysql
datadir=/doiido/mysql/data
#  service mysqld start
二、mysql优化
软件版本
libunwind:libunwind-1.1.tar.gz
google-perftools:gperftools-2.2.tar.gz
1:安装libunwind(基于64位)
#  cd /doiido/soft
#  tar zxvf libunwind-1.1.tar.gz
#  cd libunwind-1.1
#  cflags=-fpic ./configure
#  make cflags=-fpic
#  make cflags=-fpic install
2:安装google-perftools:
#  cd /doiido/soft
#  tar zxvf gperftools-2.2.tar.gz
#  cd gperftools-2.2/
#  ./configure
#  make && make install
#  echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf
#  /sbin/ldconfig
3:修改mysql启动脚本(根据mysql安装位置而定):
#  vi /doiido/server/mysql/bin/mysqld_safe
在# executing mysqld_safe的下面加上:
export ld_preload=/usr/local/lib/libtcmalloc.so
#  service mysqld restart
4:查看tcmalloc是否起效:
#  /usr/sbin/lsof -n | grep tcmalloc
如果发现以下信息,说明tcmalloc已经起效:
mysqld    11227 mysql  mem      reg                8,1  2171746      18287 /usr/local/lib/libtcmalloc.so.4.1.2
--------------------------------------分割线 --------------------------------------
ubuntu 14.04下安装mysql
《mysql权威指南(原书第2版)》清晰中文扫描版 pdf
ubuntu 14.04 lts 安装 lnmp nginx\php5 (php-fpm)\mysql
ubuntu 14.04下搭建mysql主从服务器
ubuntu 12.04 lts 构建高可用分布式 mysql 集群
ubuntu 12.04下源代码安装mysql5.6以及python-mysqldb
mysql-5.5.38通用二进制安装
--------------------------------------分割线 --------------------------------------
本文永久更新链接地址:
0
mysql 建立用户数据库方法
oracle 最大连接数 session process
相关资讯       mysql优化  linux安装mysql
图片资讯
本文评论查看全部评论 (0)
评论声明
最新资讯
本周热门
其它类似信息

推荐信息