日期:2014-05-16  浏览次数:21249 次

mysql的编译安装
#tar xvfz mysql-5.1.41.tar.gz
#cd mysql-5.1.41

#echo " CHOST=\"x86_64-pc-linux-gnu\"  CFLAGS=\"-march=native -O3 -pipe -fomit-frame-pointer\" CXX=gcc CXXFLAGS=\"-march=native -O3 -pipe -fomit-frame-pointer  -felide-constructors -fno-exceptions -fno-rtti\" ./configure --prefix=/usr/local/mysql --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --enable-assembler --with-libwrap=/usr/lib/ --with-charset=gbk --with-extra-charsets=gb2312,gbk,big5,latin1,utf8 --with-mysqld-user=mysql --with-big-tables --with-client-ldflags=-all-static --with-plugins=myisam,myisammrg,innobase,innodb_plugin,heap,csv,partition --with-mysqld-ldflags=-all-static" >configure.sh  // 编译安装

#chmod +x configure.sh
#./configure.sh

#make && make install


#groupadd mysql    /添加一个mysql组
#useradd -g mysql mysql  添加一个mysql用户到mysql组里

#cp support-files/my-medium.cnf /etc/my.cnf
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#chmod 700 /etc/init.d/mysqld
#chkconfig --add mysqld
#chkconfig --level 345 mysqld on

#cd /usr/local/mysql
#bin/mysql_install_db --user=mysql

#chown -R root .
#chown -R mysql var
#chgrp -R mysql .

#bin/mysqld_safe --user=mysql &

#bin/mysqladmin -uroot -poldpwd password XXXX




mysql 多实例安装

===================================多实例安装=======================================
#tar xvfz mysql-5.1.59.tar.gz

#cd mysql-5.1.59(Linux 5.3)
echo " CFLAGS=\"-O3 -mpentiumpro\" CXX=gcc CXXFLAGS=\"-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti\" ./configure --prefix=/usr/local/mysql --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --enable-assembler --with-libwrap=/usr/lib/ --with-charset=gbk --with-extra-charsets=gb2312,gbk,big5,latin1,utf8 --with-mysqld-user=mysql --with-big-tables --with-client-ldflags=-all-static --with-plugins=myisam,myisammrg,innobase,innodb_plugin,heap,csv,partition --with-mysqld-ldflags=-all-static" >configure1.sh

GCC4.4(Linux 6.2 )echo " CHOST=\"x86_64-pc-linux-gnu\"  CFLAGS=\"-march=native -O3 -pipe -fomit-frame-pointer\" CXX=gcc CXXFLAGS=\"-march=native -O3 -pipe -fomit-frame-pointer  -felide-constructors -fno-exceptions -fno-rtti\" ./configure --prefix=/usr/local/mysql --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --enable-assembler --with-libwrap=/usr/lib/ --with-charset=gbk --with-extra-charsets=gb2312,gbk,big5,latin1,utf8 --with-mysqld-user=mysql --with-big-tables --with-client-ldflags=-all-static --with-plugins=myisam,myisammrg,innobase,innodb_plugin,heap,csv,partition --with-mysqld-ldflags=-all-static" >configure.sh



如果编译出现问题需要安装一下ncurses-devel-5.5-24.20060715.x86_64.rpm

#chmod +x configure.sh

#./configure.sh

#make && make install

创建mysql用户
#groupadd mysql
#useradd -g mysql mysql

#cp support-files/my-medium.cnf /etc/my.cnf
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#cp support-files/mysqld_multi.server /etc/rc.d/init.d/mysqld_multi

#chmod 700 /etc/init.d/mysqld
(忽略该步)#chkconfig --add mysqld
(忽略该步)#chkconfig --level 2345 mysqld off

#cd /usr/local/mysql

 show variables like 'server_id';
 查看server-id
mysql> show variables like 'server_id'; 
手动修改server-id
mysql> set global server_id=2; #此处的数值和my.cnf里设置的一样就行 
mysql> slave start;

6)change master之后,查看slave的状态,发现slave_IO_running 为NO
需要注意的是,做完上述操作之后最后重启mysql进程
 
(初始化数据目录)
#bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var21001/
#bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var21002/
#bin/mysql_install_db --user=