Chinaunix首页 | 论坛 | 博客
  • 博客访问: 815401
  • 博文数量: 127
  • 博客积分: 3662
  • 博客等级: 中校
  • 技术积分: 1371
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-02 12:36
个人简介

Linux&MySQL&PHP&Nginx&Apache&MSSQL&Shell

文章分类

全部博文(127)

文章存档

2016年(1)

2015年(8)

2014年(14)

2013年(26)

2012年(17)

2011年(28)

2010年(33)

分类: Mysql/postgreSQL

2012-12-04 13:22:46

yum –y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml2
ncurses-devel libmcrypt* libtool-ltdl-devel*
# mkdir -p /usr/local/mysql/
# groupadd mysql
# useradd -g mysql mysql
# chown mysql.mysql -R /usr/local/mysql/

mysql5.5以后是通过cmake来编译的
yum -y install cmake或者编译安装
#cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_TCP_PORT=3306 \
-DEXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_USER=mysql \
-DWITH_DEBUG=0

#make & make install
拷贝配置文件和启动文件
# cp support-files/my-medium.cnf /etc/my.cnf
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod 755 /etc/init.d/mysqld
初始化数据库
# bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql 
# /etc/init.d/mysqld start
# ln -s /usr/local/mysql/bin/* /sbin/或export PATH=/usr/local/mysql/bin:$PATH

续:

一台MySQL服务器启动多个端口(mysqld_multi)

# bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql - datadir=/usr/local/mysql/data3307


# bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql -- datadir=/usr/local/mysql/data3308


# bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql -- datadir=/usr/local/mysql/data3309


现在/usr/local/mysql下会自动创建data3307,08,09三个目录


#chown -R mysql.mysql ../mysql/data3307

#chown -R mysql.mysql ../mysql/data3308

#chown -R mysql.mysql ../mysql/data3309


#cp /usr/local/mysql-5.5.28/support-files/mysqld_multi.server /etc/init.d/mysqld_multi.server


#vi /etc/init.d/mysqld_multi.server

#修改basedir和bindir为安装路径  

#basedir=/usr/local/mysql  

#bindir=/usr/local/mysql/bin 


用mysqld_multi工具查看该配置文件的模板方法,命令为:mysqld_multi --example

#mysqld_multi --example >>/etc/mysqld_multi.cnf直接将模板输入到被指文件,然后进行修改

 如下:

点击(此处)折叠或打开

  1. [mysqld_multi]
  2. mysqld = /usr/local/mysql/bin/mysqld_safe
  3. mysqladmin = /usr/local/mysql/bin/mysqladmin
  4. user = multi_admin
  5. password = my_password

  6. [mysqld2]
  7. socket = /tmp/mysql3307.sock
  8. port = 3307
  9. pid-file = /usr/local/mysql/data3307/localhost3307.pid
  10. datadir = /usr/local/mysql/data3307
  11. #language = /usr/local/mysql/share/mysql/english
  12. user = mysql

  13. [mysqld3]
  14. socket = /tmp/mysql3308.sock
  15. port = 3308
  16. pid-file = /usr/local/mysql/data3308/localhost3308.pid
  17. datadir = /usr/local/mysql/data3308
  18. #language = /usr/local/mysql/share/mysql/swedish
  19. user = mysql

  20. [mysqld4]
  21. socket = /tmp/mysql3309.sock
  22. port = 3309
  23. pid-file = /usr/local/mysql/data3309/localhost3309.pid
  24. datadir = /usr/local/mysql/data3309
  25. #language = /usr/local/mysql/share/mysql/estonia
  26. user = mysql

将/usr/local/mysql/bin加到$PATH环境变量里  

export PATH=/usr/local/mysql/bin:$PATH  


#mysqld_multi --defaults-extra-file=/etc/mysqld_multi.cnf report


#mysqld_multi --defaults-extra-file=/etc/mysqld_multi.cnf start


阅读(2607) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~