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-idmysql> show variables like 'server_id'; 手动修改server-idmysql> 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=mysql --datadir=/usr/local/mysql/var21003/ #bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var(默认) #chown -r root .#chown -r mysql var21001/ var21002/ var21003/#chgrp -r mysql . #bin/mysqld_safe --user=mysql & (到此安装完成)#bin/mysqladmin -uroot -poldpwd password 1qaz@wsx grant shutdown on *.* to admin@localhost identified by 'pwd_shutdown'; flush privileges; linux 客户端执行sql命令:source /home/software/user_login.sql grant all privileges on *.* to 'root'@'%' identified by '123456'; flush privileges; grant shutdown on *.* to 'admin'@'localhost' identified by 'pwd_shutdown'; flush privileges; drop user ''@'localhost.localdomain';drop user ''@'localhost';drop user root@localhost.localdomain; grant shutdown on *.* to 'admin'@'localhost' identified by 'pwd_shutdown'; set password for root@'localhost' =password('1qaz@wsx');set password for root@'127.0.0.1' =password('1qaz@wsx');flush privileges;//set password for root@'localhost' =password('xxx');//set password for root@'127.0.0.1' =password('xxx'); 主从权限增加grant replication slave on *.* to 'repsync'@'%' identified by '*********'; ===================================多实例安装=======================================
bitscn.com