linux安装mysql

一、上传或下载安装包(注意内存)

下载地址:https://downloads.mysql.com/archives/community/

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar

二、解压

tar -xvf mysql-8.1.0-1.el7.x86_64.rpm-bundle.tar -C path(解压目录)

注:解压文件没有外面的mysql文件夹,需要自己建 mkdir mysql,移动多个文件,可用通配符,例:mv *.rpm path(目的路径)

三、安装插件

yum install openssl-devel

yum -y install perl

yum -y install perl-Data-Dumper

yum -y install perl-JSON

yum -y install net-tools

四、干掉mariadb

yum remove mariadb

yum list installed|grep mariadb

yum remove mariadb-libs

五、进入解压目录安装mysql

yum install libcrypto*

rpm -ivh mysql-community-common-8.0.18-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-8.0.18-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-compat-8.0.18-1.el7.x86_64.rpm

rpm -ivh mysql-community-devel-8.0.18-1.el7.x86_64.rpm

rpm -ivh mysql-community-embedded-compat-8.0.18-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-8.0.18-1.el7.x86_64.rpm

rpm -ivh mysql-community-server-8.0.18-1.el7.x86_64.rpm

rpm -ivh mysql-community-test-8.0.18-1.el7.x86_64.rpm

六、启动mysql

systemctl start mysqld

七、查看mysql的root账户随机生成的密码

grep 'temporary password' /var/log/mysqld.log

八、登录mysql

mysql -uroot -p

九、修改密码

由于MySQL8.0 有密码验证组件,若希望设置简单的密码,需要修改服务验证条件,密码检查等级,0/LOW、1/MEDIUM、2/STRONG

set global validate_password.policy=0;

密码的最短长度

set global validate_password.length=8;

密码至少要包含的小写字母个数和大写字母个数

set global validate_password.mixed_case_count=0;

设置密码

alter user 'root'@'localhost' identified by 'new_password';

十、远程权限

由于默认是localhost,所以如果远程需要修改

update user set host='%' where user='root';

flush privileges;

十一、卸载

查看安装的

rpm -qa|grep mysql

rpm -ev 查出来的

posted @ 2023-11-01 01:58  此时不卷何时卷  阅读(33)  评论(0编辑  收藏  举报