centos 7.6 rpm 安装mysql8.0
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 删除文件夹:
ERROR 1290 (HY000): The MySQL server
is
running
with
the
--skip-grant-tables option so it cannot execute this statement
mysql> flush
privileges
;
Query OK, 0
rows
affected (0.00 sec)
mysql>
mysql>
mysql>
mysql>
grant
select
,
insert
,
update
,
delete
on
*.*
to
'root'
@
'%'
;
Query OK, 0
rows
affected, 1 warning (0.00 sec)
mysql>
grant
all
on
*.*
to
'root'
@
'%'
;
Query OK, 0
rows
affected (0.00 sec)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步