1.https://dev.mysql.com/downloads/mysql/
2.
3.下载下来的tar包传入到linux系统中解压
4.进行安装 必须按步骤安装, 否则会出现依赖错误
rpm -ivh mysql-community-common-8.0.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.29-1.el7.x86_64.rpm
5.mysqld --initialize --console 初始化数据库
6.chown -R mysql:mysql /var/lib/mysql 设置权限
7.systemctl start mysqld 启动数据库服务
8.cat /var/log/mysqld.log |grep localhost 查找初始密码
9.登录数据库
10.alter user 'root'@'localhost' identified by '123456';
- 设置可以访问数据的权限
use mysql
update user set host = '%' where user ='root';
flush privileges;