转载:http://blog.csdn.net/xiegh2014/article/details/72860951
一、检查系统是否安装其他版本的MysqL数据 yumlistinstalled|grepMysqL yum-yremoveMysqL-libs.x86_64 二、安装及配置 wgethttp://repo.MysqL.com/MysqL-community-release-el6-5.noarch.rpm rpm-ivhMysqL-community-release-el6-5.noarch.rpm yumrepolistall|grepMysqL 1、安装MysqL数据库 yuminstallMysqL-community-server-y 2、设置为开机启动 chkconfig--list|grepMysqLd chkconfigMysqLdon 3、设置密码 /usr/bin/MysqLadmin-urootpassword'123456' 4、修改root密码 MysqL-uroot-p123456 MysqL>selectHost,User,PasswordfromuserwhereUser='root'; +-----------------------+------+-------------------------------------------+ |Host|User|Password| +-----------------------+------+-------------------------------------------+ |localhost|root|*4A82FDF1D80BA7470BA2E17FEEFD5A53D5D3B762| |localhost.localdomain|root|| |127.0.0.1|root|| |::1|root|| +-----------------------+------+-------------------------------------------+ 4rowsinset(0.00sec) MysqL>updateusersetPassword=password('123456')whereUser='root'; QueryOK,4rowsaffected(0.03sec) Rowsmatched:4Changed:4Warnings:0 MysqL>selectHost,PasswordfromuserwhereUser='root'; +-----------------------+------+-------------------------------------------+ |Host|User|Password| +-----------------------+------+-------------------------------------------+ |localhost|root|*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9| |localhost.localdomain|root|*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9| |127.0.0.1|root|*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9| |::1|root|*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9| +-----------------------+------+-------------------------------------------+ 4rowsinset(0.00sec) MysqL>flushprivileges; QueryOK,0rowsaffected(0.00sec)原文链接:https://www.f2er.com/centos/375377.html