程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> mysql的編譯安裝

mysql的編譯安裝

編輯:MySQL綜合教程


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   www.2cto.com   #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   www.2cto.com   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   www.2cto.com   如果編譯出現問題需要安裝一下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   www.2cto.com   #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=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 &   www.2cto.com     (到此安裝完成) #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 [email protected];   GRANT SHUTDOWN ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'pwd_shutdown';   www.2cto.com   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 '*********';   ===================================多實例安裝=======================================
 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved