centos7安装mysql6.5、6.7
- 安装mysql5.6
1、配置mysql6.5yum源
wget -P . http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm
清理yum源缓存
yum clean all && yum makecache
2、安装数据库
yum -y install mysql mysql-server
mysql5.6不用输入密码可以直接输入mysql进入数据库
3、修改mysql密码
use mysql;
set password for root@localhost = password('password');
4、创建用户并授权
create user 'wordpress'@'localhost' identified by 'password';
grant all privileges on database.* to user@'%' with grant option;
- 安装mysql5.7安装
1、下载并安装MySQL官方的 yum源并加载yum缓存
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7- 10.noarch.rpm
yum clean all && yum makecache
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
2、重置mysql密码
grep "password" /var/log/mysqld.log
2019-07-18T10:27:59.058559Z 1 [Note] A temporary password is generated for root@localhost: x8w4o<fnsbye< div="">
登录mysql
mysql -uroot -p 输入初始密码,此时不能做任何事情,因为MySQL默认必须修改密码之后才能操作数据库
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
mysql>flush privileges;

浙公网安备 33010602011771号