centos7用rpm安装mysql5.7

步骤一:下载

mysql-community-client-5.7.26-1.el7.x86_64.rpm
mysql-community-common-5.7.26-1.el7.x86_64.rpm
mysql-community-libs-5.7.26-1.el7.x86_64.rpm
mysql-community-server-5.7.26-1.el7.x86_64.rpm

如下给出了4个myql5.7 的rpm包的路径,直接打开迅雷填入下载路径就可以进行下载,其他版本可以用同样方法:

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.26-1.el7.x86_64.rpm

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.26-1.el7.x86_64.rpm

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.26-1.el7.x86_64.rpm

 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.26-1.el7.x86_64.rpm

步骤二:安装

通过 rpm -ivh mysql-community-****-5.7.26-1.el7.x86_64.rpm --force --nodeps 进行安装,***表示common 、libs、client、server

安装顺序 common-->libs-->client-->server

如果没有--force --nodeps会出现告警:

  warning: mysql-community-common-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

步骤三:启动

启动mysql服务 :

[root@localhost ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@localhost ~]#

找到初始密码:

[root@localhost ~]# cat /var/log/mysqld.log |grep password
2019-06-02T08:39:38.448115Z 1 [Note] A temporary password is generated for root@localhost: dLZMCRv?s2q)
2019-06-02T08:40:41.870130Z 2 [Note] Access denied for user 'root'@'localhost' (using password: NO)

登陆mysql:

[root@localhost ~]# mysql -u root -p

密码为上面找到的dLZMCRv?s2q)

修改root密码:

mysql> alter user 'root'@'localhost' identified by 'newpasswd';

允许远程连接:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpasswd' WITH GRANT OPTION;

mysql> FLUSH PRIVLEGES;

关闭防火墙:

[root@localhost ~]# systemctl stop firewalld.service

 

你可能感兴趣的:(linux工具和其他工具,DataBase)