之前在网上找的的资料是这样的
yum install -y mysql-server mysql mysql-devel
但是发现在我的linux上无法进行安装,我的版本信息:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.0.1406 (Core)
Release: 7.0.1406
Codename: Core
下面说一下我的解决方法,首先
wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm
再执行
rpm -Uvh mysql57-community-release-el7-7.noarch.rpm
然后,会出现很多的mysql信息
yum repolist all | grep mysql
接着,创建一个文件,/etc/yum.repos.d/mysql-community.repo
在文件内写入如下内容
[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
再执行
yum repolist enabled | grep mysql
之后进行安装:
yum install mysql-community-server
完成安装后启动
service mysqld start
查看mysql初始密码
grep 'temporary password' /var/log/mysqld.log
再登录、修改密码即可:
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
祝大家捣鼓的愉快