首先查看mysql依赖
yum list installed | grep mysql
卸载掉mysql-lib依赖
yum -y remove mysql-libs.x86_64
这样子可以防止依赖冲突
如果没有wget需要安装一下
yum install wget -y
添加rpm源
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
安装下载的rpm
yum install mysql-community-release-el6-5.noarch.rpm -y
安装成功后会在 /etc/yum.repos.d/ 文件夹下增加两个文件
其中mysql-community.repo 需要修改 , 看准版本
yum安装mysql
yum install mysql-community-server -y
设置mysql开机自启
# 启动mysqlservice mysqld start# 开机自启chkconfig mysqld on
获取临时密码
grep "pasword" /var/log/mysqld.log
临时密码登录
mysql -uroot -p#输入临时密码
修改密码以及远程权限
# 修改密码set global validate_password_policy=0;set global validate_password_length=1;ALTER USER 'root'@'localhost' identified by '123456';# 修改远程权限grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;# 刷新权限flush privileges;