【實戰】maridb 10.0.15 on centos 6.5 安裝,maridbcentos
maridb 10.0.15 on centos 6.5 安裝******************************************************************************1.系統部分******************************************************************************--------1.desktop安裝即可,選擇自訂選擇下面兩個包,其它根據自己需求選擇base systemlegacy unix compatibility(rsh telnet ksh tftp )Desktopslegacy x window system compatibility (xorg-x11-xdm)-------2 配置yum源cd /etc/yum.repos.dmv CentOS-Base.repo CentOS-Base.repo.oldwget http://mirrors.163.com/.help/CentOS6-Base-163.repoyum makecache檢查可更新的rpm包#yum check-update 更新所有的rpm包#yum update---3.XDM配置---3.1 centos 6.5 1). 安裝XDMyum install xdm 2).vi /etc/X11/xdm/Xaccess49 * #any host can get a login window3).修改/etc/gdm/custom.conf檔案。vi /etc/gdm/custom.conf[xdmcp]Enable=trueDisplaysPerHost=5Port=177[security]AllowRemoteRoot=true4).重啟gdm服務/usr/sbin/gdm -restart---4.關閉防火牆chkconfig --level 123456 iptables offservice iptables stop---5.修改hostsvi /etc/hosts192.168.0.128sphinx.ocp.com sphinx******************************************************************************2.mysql安裝部分******************************************************************************一:卸載舊版本使用下面的命令檢查是否安裝有MySQL Serverrpm -qa | grep mysql有的話通過下面的命令來卸載掉rpm -e mysql //普通刪除模式rpm -e --nodeps mysql // 強力刪除模式,如果使用上面命令刪除時,提示有依賴的其它檔案,則用該命令可以對其進行強力刪除二:安裝MySQL1.安裝編譯代碼需要的包yum -y install cmake gcc gcc-c++ autoconf automake zlib* libxml* \ncurses ncurses-devel libtool-ltdl-devel* make bison bison-devel libaio 2.為mysql新群組和使用者groupadd mysqluseradd -g mysql mysql 3.設定使用者的系統資源限制#vi /etc/security/limits.confmysql soft nproc 2047mysql hard nproc 16384mysql soft nofile 1024mysql hard nofile 655364.編譯安裝tar xvf mariadb-10.0.15.tar.gzcd mariadb-10.0.15編譯安裝cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/usr/local/mysql/data \-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \-DSYSCONFDIR=/etc \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_SPHINX_STORAGE_ENGINE=1 \-DWITH_XTRADB_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_EXTRA_CHARSETS=all \-DENABLED_LOCAL_INFILE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DEXTRA_CHARSETS=all \-DMYSQL_TCP_PORT=3306 \-DWITH_DEBUG=0make make install整個過程需要30分鐘左右.三:配置MySQL1.修改/usr/local/mysql許可權#mkdir -p /usr/local/mysql2.建立資料檔案、臨時檔案mkdir /usr/local/mysql/{innodb_data,data,tmp} -pmkdir /usr/local/mysql/mysql_logs/{binary_log,innodb_log,query_log,slow_query_log,error_log} -p3.修改許可權chown -R mysql /usr/local/mysqlchgrp -R mysql /usr/local/mysql4.修改參數#rm -rf /etc/my.cnf#vi /usr/local/mysql/my.cnf##連結檔案#ln -s /usr/local/mysql/my.cnf /etc/my.cnfll /etc/my.cnf lrwxrwxrwx. 1 root root 23 Nov 18 17:30 /etc/my.cnf -> /usr/local/mysql/my.cnf5.初始化資料庫cd /usr/local/mysql/scripts # ./mysql_install_db --defaults-file=/etc/my.cnf --user=mysql --basedir=/usr/local/mysql \--datadir=/usr/local/mysql/data /*********************註:在啟動MySQL服務時,會按照一定次序搜尋my.cnf,1)./etc/my.cnf2)./etc/mysql/my.cnf3).SYSCONFDIR/my.cnf4).$MYSQL_HOME/my.cnf5).defaults-extra-file6).~/.my.cnf7).~/.mylogin.cnf**********如果不指定defaults-file可能會如下錯誤:[Warning] InnoDB: Cannot open table mysql/slave_master_info[Warning] InnoDB: Cannot open table mysql/slave_worker_info[Warning] InnoDB: Cannot open table mysql/slave_relay_log_info****************/提供二進位檔案,庫檔案,標頭檔,man手冊echo 'export PATH=/data/apps/mysql/bin:$PATH' > /etc/profile.d/mysql.shecho '/data/apps/mysql/lib' > /etc/ld.so.conf.d/mysql.confln -sv /usr/local/include /usr/include/mysqlecho 'MANPATH /data/apps/mysql' >> /etc/man.configman -M /data/apps/mysql/man mysqld --讓man手冊立刻生效為最新6.啟動MySQL添加服務,拷貝服務指令碼到init.d目錄,並設定開機啟動cd /usr/local/mysql/cp support-files/mysql.server /etc/init.d/mysqlchkconfig mysql onservice mysql start 7.配置mysql使用者MySQL啟動成功後,root預設沒有密碼,我們需要設定root密碼。7.1修改/etc/profile檔案,在檔案末尾添加#vi /etc/profilePATH=/usr/local/mysql/bin:$PATHexport PATH#source /etc/profile現在,我們可以在終端內直接輸入mysql進入,mysql的環境了執行下面的命令修改root密碼--7.2修改mysql管理員密碼---方法1:mysql -uroot -h127.0.0.1 -pSET PASSWORD = PASSWORD('password');flush privileges;--7.3 登入mysql# mysql -uroot -ppassword--7.4 設定mysql使用者安全(不適用)select user,host from mysql.user;delete from mysql.user where (user,host) not in(select 'root','localhost');#修改root的使用者名稱和密碼update mysql.user set user='system',password=password('password') where user='root';truncate table mysql.db;#建立管理員的文法grant all on *.* to 'root'@'%' identified by "password" WITH GRANT OPTION;--7.5 設定root使用者可以遠端存取--方法1:授權法mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;flush privileges;select host,user,password from mysql.user;--方法2:修改表mysql> update user set host ='%' where user = 'root';mysql> flush privileges; ----7.6設定linux指令碼vi ~/.bash_profile#ocpyang setalias mysql="mysql -uroot -ppassword --auto-rehash"alias errorlog="cat /usr/local/mysql/mysql_logs/error_log/error.log"alias mycnf="cd /usr/local/mysql"export PATH=/usr/local/mysql/scripts:$PATHsource ~/.bash_profile----7.7修改許可權chown -R mysql /usr/local/mysqlchgrp -R mysql /usr/local/mysql----常見啟動錯誤或警告cat /usr/local/mysql/mysql_logs/error_log/error.log Warning] 'proxies_priv' entry '@% root@sphinx.ocp.com' ignored in --skip-name-resolve mode.解決辦法:delete from mysql.proxies_priv where host='sphinx.ocp.com';commit;flush privileges;