CentOS6.7下安装MySQL

前端之家收集整理的这篇文章主要介绍了CentOS6.7下安装MySQL前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Step1: 检测系统是否自带安装MysqL

#yumlistinstalled|grepMysqL

Step2: 删除系统自带MysqL及其依赖
命令:

#yum-yremoveMysqL-libs.x86_64

Step3: 给CentOS添加rpm源,并且选择较新的源

MySQL官网上下载Linux版本的MysqL rpm 安装包。

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716160006933">



Step4: 将该压塑包解压后,有如下文件

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;height:auto;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716163348901">


Step5:安装文件,我们需要安装的文件

MysqL-server-5.6.26-1.linux_glibc2.5.i386.rpm、MysqL-client-5.6.26-1.linux_glibc2.5.i386.rpm、MysqL-devel-5.6.26-1.linux_glibc2.5.i386.rpm

1、执行命令rpm -ivh MysqL-server-5.6.26-1.linux_glibc2.5.i386.rpm 安装server.

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716163419456">


由上图可以见,我们安装并没有成功,与系统原有的5.1.73版本的MysqL冲突了,怎么办呢?山人自有妙计,执行命令yum -y remove MysqL-libs-5.1.73* ,移除冲突的文件

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716163542332">


移除冲突文件之后,我们再次执行命令rpm -ivh MysqL-server-5.6.26-1.linux_glibc2.5.i386.rpm 安装server.

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;height:auto;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716163742506">


上面是安装MysqL server成功时所产生的日志,看到划红线的日志了么 ?是的,会产生个随机密码给MysqL root用户.

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716170341214">


2、安装client和devel文件.

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;height:auto;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716163840871">


至此,MysqL已安装完成。

启动MysqL,service MysqL start .

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;height:auto;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716164017635">


用上面文件里的随机密码就可以登录MysqL 了。

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;height:auto;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716170119508">


3、更改MysqL密码.

执行如下语句可以修改MysqL用户密码,当然前提是用那个随机密码登录进来.

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');

@H_403_19@650) this.width=650;" style="border-bottom:medium none;border-left:medium none;height:auto;border-top:medium none;border-right:medium none;" alt="" src="http://img.jb51.cc/vcimg/static/loading.png" src="http://img.blog.csdn.net/20160716171550793">

猜你在找的CentOS相关文章