数据库
首页 > 数据库> > linux安装mysql

linux安装mysql

作者:互联网

1.下载

wget http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar

  

 

 

2.解压

tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar -C ../software/

 

3.删除mariadb

  

 

 

4.执行

yum install libaio

 

5.将文件移动

  之前解压出现问题

  

 

 

6.依次执行

  进入mysql目录下执行

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

 

7.启动

systemctl start mysqld.service

 

8.查询随机密码

  mysql 自动给 root 用户设置随机密码,运行命令可查看当前密码

grep "password" /var/log/mysqld.log

 

9.进入

mysql -u root -p

 

10.设置密码、

set password for 'root'@'localhost'=password('root');
flush privileges;

  

  可以参考密码设置文档:https://blog.csdn.net/u013449046/article/details/106455041/

 

11.添加权限

  目前navicat不能访问

use mysql;
SELECT Host, User FROM user;
UPDATE user SET Host = '%' WHERE User = 'root';
flush privileges;

  

 

  

 

标签:26,5.7,安装,mysql,64,linux,rpm,el7
来源: https://www.cnblogs.com/juncaoit/p/16576307.html