centos6.5安装mysql5.6

1.下载mysql rpm包

下载地址:http://dev.mysql.com/downloads/repo/yum/

我选择的是:http://repo.mysql.com//mysql57-community-release-el6-8.noarch.rpm

添加mysql yum源仓库

rpm -ivh mysql57-community-release-el6-8.noarch.rpm

新建/etc/yum.repos.d/mysql-community.repo文件

5.7版本

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
5.6版本

# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
把新增的mysql yum添加到yum仓库

yum repolist enabled | grep mysql
2.安装mysql

yum install mysql-community-server 
3.启动mysql服务

service mysqld start
查看mysql状态

service mysqld status
mysql5.7设置root密码

mysql -uroot -p 

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; 
mysql5.6设置root密码

mysql_secure_installation

mysql官方文档地址:http://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/


你可能感兴趣的:(数据库)