1.检查是否安装了mysql
rpm -qa|grep mysql //检查是否安装了mysql rpm -qa|grep mariadb //检查是否安装了mariadb
删除包: rpm -e --nodeps mysql-community-common-8.0.23-1.el7.x86_64
检查mysql相关的文件夹: find / -name mysql 删除文件夹: rm -rf path
如果没有wget 命令,安装wget: yum install wget
2.进行远程仓库的创建:执行下面语句:默认目录:/root/
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
3.安装mysql
3.1.安装命令: 进入/etc/yum.repos.d/目录后在执行一下脚本: 安装: [root@VM-0-13-centos yum.repos.d]# yum install mysql-server
启动:systemctl start mysqld 检查是否启动成功:systemctl status mysqld
4.首次登录修改密码
获取安装的临时密码: grep ‘temporary password‘ /var/log/mysqld.log
登录:mysql -uroot -p alter user ‘root‘@‘localhost‘ identified by ‘Aa@123123‘; //大小写字母,特殊字符,数字
5.创建远程访问用户(登录mysql8.0后)
create user ‘root‘@‘%‘ identified by ‘Sa@123123‘;
alter user ‘root‘@‘%‘ identified by ‘SaSa@123123‘ ;
授权远程访问用户:grant all on . to ‘root‘@‘%‘; 刷新:flush privileges;
6.远程连接mysql,修改用户身份验证机制
alter user ‘root‘@‘%‘ identified with mysql_native_password by ‘Bb@123123‘; 刷新:flush privileges;
7..卸载mysql
rpm -qa|grep mysql ? rpm -e --nodeps mysqlname
删除包: rpm -e --nodeps mysql-community-common-8.0.23-1.el7.x86_64
检查mysql相关的文件夹: find / -name mysql 删除文件夹: