Home  >  Article  >  Database  >  【实战】maridb10.0.15oncentos6.5安装

【实战】maridb10.0.15oncentos6.5安装

WBOY
WBOYOriginal
2016-06-07 16:11:031412browse

maridb 10.0.15 on centos 6.5 安装******************************************************************************1.系统部分******************************************************************************--------1.desktop安装即可,选择自定义选择

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.d

mv CentOS-Base.repo CentOS-Base.repo.old


wget http://mirrors.163.com/.help/CentOS6-Base-163.repo


yum makecache


检查可更新的rpm包
#yum check-update
    
更新所有的rpm包
#yum update


---3.XDM配置

---3.1 centos 6.5 

1). 安装XDM

yum install xdm 



2).vi /etc/X11/xdm/Xaccess


49 * #any  host  can  get  a  login  window



3).修改/etc/gdm/custom.conf文件。

vi /etc/gdm/custom.conf

[xdmcp]
Enable=true
DisplaysPerHost=5
Port=177

[security]
AllowRemoteRoot=true




4).重启gdm服务

/usr/sbin/gdm -restart





---4.关闭防火墙

chkconfig --level 123456 iptables off

service iptables stop


---5.修改hosts


vi /etc/hosts

192.168.0.128	sphinx.ocp.com sphinx

******************************************************************************
2.mysql安装部分
******************************************************************************


一:卸载旧版本

使用下面的命令检查是否安装有MySQL Server
rpm -qa | grep mysql

有的话通过下面的命令来卸载掉
rpm -e mysql   //普通删除模式
rpm -e --nodeps mysql   

// 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,
则用该命令可以对其进行强力删除








二:安装MySQL


1.安装编译代码需要的包

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 mysql
useradd -g mysql  mysql 




3.设置用户的系统资源限制

#vi /etc/security/limits.conf

mysql            soft    nproc   2047
mysql            hard    nproc   16384
mysql            soft    nofile  1024
mysql            hard    nofile  65536





4.编译安装

tar xvf mariadb-10.0.15.tar.gz

cd 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=0



make 

make install



整个过程需要30分钟左右.




三:配置MySQL


1.修改/usr/local/mysql权限

#mkdir -p /usr/local/mysql


2.新建数据文件、临时文件



mkdir /usr/local/mysql/{innodb_data,data,tmp} -p

mkdir /usr/local/mysql/mysql_logs/{binary_log,innodb_log,query_log,slow_query_log,error_log} -p





3.修改权限


chown -R mysql /usr/local/mysql
chgrp -R mysql /usr/local/mysql



4.修改参数



#rm -rf /etc/my.cnf

#vi /usr/local/mysql/my.cnf

##链接文件
#ln -s  /usr/local/mysql/my.cnf  /etc/my.cnf

ll /etc/my.cnf 
lrwxrwxrwx. 1 root root 23 Nov 18 17:30 /etc/my.cnf -> /usr/local/mysql/my.cnf

5.初始化数据库


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.cnf
3).SYSCONFDIR/my.cnf
4).$MYSQL_HOME/my.cnf
5).defaults-extra-file
6).~/.my.cnf
7).~/.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.sh

echo '/data/apps/mysql/lib' > /etc/ld.so.conf.d/mysql.conf

ln -sv /usr/local/include /usr/include/mysql


echo 'MANPATH /data/apps/mysql' >> /etc/man.config

man -M /data/apps/mysql/man mysqld  --让man手册立刻生效为最新





6.启动MySQL

添加服务,拷贝服务脚本到init.d目录,并设置开机启动

cd /usr/local/mysql/

cp support-files/mysql.server /etc/init.d/mysql

chkconfig mysql on

service mysql start  






7.配置mysql用户

MySQL启动成功后,root默认没有密码,我们需要设置root密码。


7.1修改/etc/profile文件,在文件末尾添加

#vi /etc/profile

PATH=/usr/local/mysql/bin:$PATH
export PATH


#source /etc/profile

现在,我们可以在终端内直接输入mysql进入,mysql的环境了

执行下面的命令修改root密码

--7.2修改mysql管理员密码

---方法1:

mysql -uroot  -h127.0.0.1 -p

SET 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 set

alias  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:$PATH


source ~/.bash_profile


----7.7修改权限

chown -R mysql /usr/local/mysql
chgrp -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;







Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn