当前位置:Gxlcms > mysql > mysql的编译安装_MySQL

mysql的编译安装_MySQL

时间:2021-07-01 10:21:17 帮助过:48人阅读

bitsCN.com
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

人气教程排行