Linux 使用mysql官方 yum 源 安装

新装了一台centos6.5的服务器,安装mysql,这里使用了mysql的官方yum源,官方文档 https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/ ,一些看都不懂英文文档的小伙伴可以看一下下面的安装步骤:

1.下载rpm包,并安装RPM源:

wget http://dev..com/get/57-community-release-el6-8.noarch.rpm
rpm -Uvh mysql57-community-release-el6-n.noarch.rpm

创建mysql的yum源,vim /etc/yum.repos.d/mysql-community.repo , 填入内容如下,我们这里安装的是5.7的版本mysql 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

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

2.生效mysql源:

yum repolist enabled | grep mysql

3.yum安装mysql:

yum install mysql-community-server

4.启动mysql服务:

service mysqld start

5.查看mysql的root临时密码:

grep 'temporary password' /var/log/mysqld.log

6.重设mysql的root密码,这里键入完成后需要输入第5步中显示出来的密码:

mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';

搬瓦工年付$28CN2高速线路,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠BWH26FXH3HIQ点击购买】!

Vultr月付$3.5日本节点,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快【点击购买】!

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Scroll Up