首页 > 代码库 > 【实战】maridb 10.0.15 on centos 6.5 安装

【实战】maridb 10.0.15 on centos 6.5 安装

maridb 10.0.15  on centos 6.5 安装******************************************************************************1.系统部分******************************************************************************--------1.desktop安装即可,选择自定义选择下面两个包,其它根据自己需求选择base system	legacy unix compatibility(rsh telnet ksh tftp  )Desktops	legacy 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.128	sphinx.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.cnf	2)./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;

【实战】maridb 10.0.15 on centos 6.5 安装