博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql的安装与卸载与Navicat远程连接
阅读量:2134 次
发布时间:2019-04-30

本文共 2884 字,大约阅读时间需要 9 分钟。

mysql卸载与安装

一、卸载

1、查看是否有mysql

mysql -uroot -p或者yum list installed mysql*或者rpm -qa | grep -i mysql

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

2、卸载

1.yum remove mysql mysql-server mysql-libs compat-mysql513.rm -rf /var/lib/mysql4.rm /etc/my.cnf

如果装了mysql-devel(其他一样add command),卸载为:

yum remove mysql mysql-devel mysql-server mysql-libs compat-mysql51

输入:y

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

二、创建一个用户

1、创建用户并添加密码

[root@localhost ~]# adduser yanwang
[root@localhost ~]# passwd yanwang更改用户 zhangbiao 的密码 。新的 密码:无效的密码: 密码未通过字典检查 - 过于简单化/系统化重新输入新的 密码:passwd:所有的身份验证令牌已经成功更新。

2、授权

新创建的用户并不能使用sudo命令,需要给他添加授权。

sudo命令的授权管理是在sudoers文件里的。可以看看sudoers:

[root@localhost ~]# sudoersbash: sudoers: 未找到命令...[root@localhost ~]# whereis sudoerssudoers: /etc/sudoers /etc/sudoers.d /usr/libexec/sudoers.so /usr/share/man/man5/sudoers.5.gz

3、找到这个文件位置之后再查看权限:

[root@localhost ~]# ls -l /etc/sudoers-r--r----- 1 root root 4251 9月  25 15:08 /etc/sudoers

4、是的,只有只读的权限,如果想要修改的话,需要先添加w权限:

[root@localhost ~]# chmod -v u+w /etc/sudoersmode of "/etc/sudoers" changed from 0440 (r--r-----) to 0640 (rw-r-----)

5、然后就可以添加内容了,在下面的一行下追加新增的用户:

[root@localhost ~]# vim /etc/sudoers  ## Allow root to run any commands anywher  root    ALL=(ALL)       ALL  yanwang  ALL=(ALL)       ALL  #这个是新增的用户

在这里插入图片描述

6、wq保存退出,这时候要记得将写权限收回:

[root@localhost ~]# chmod -v u-w /etc/sudoersmode of "/etc/sudoers" changed from 0640 (rw-r-----) to 0440 (r--r-----)

7、这时候使用新用户登录,使用sudo:

[zhangbiao@localhost ~]$ sudo cat /etc/passwd[sudo] password for yanwang:  We trust you have received the usual lecture from the local SystemAdministrator. It usually boils down to these three things:     #1) Respect the privacy of others.    #2) Think before you type.    #3) With great power comes great responsibility.

三、安装mysql8.0

*重要说明:如果普通用户。命令前加sudo获取临时权限,root用户不用

1、获取安装源

wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

在这里插入图片描述

2、下载rpmmysql文件

rpm -ivh mysql80-community-release-el7-3.noarch.rpm

在这里插入图片描述

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-t83LuMm3-1622438877867)(C:\Users\花孜然\AppData\Roaming\Typora\typora-user-images\image-20210531113224808.png)]

3、安装mysql服务

yum install mysql-server

在这里插入图片描述

输入y确定

在这里插入图片描述

在这里插入图片描述

4、启动mysql服务

systemctl start mysqld

在这里插入图片描述

5、获取临时密码

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

在这里插入图片描述

6、登陆mysql

mysql -uroot -p

在这里插入图片描述

7、修改密码格式和密码

set global validate_password.policy=0;set global validate_password.length=4;set global validate_password.check_user_name=OFF;set global validate_password.number_count=0;set global validate_password.special_char_count=0;

更改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

在这里插入图片描述

使用修改密码登陆

mysql -uroot -p123456

在这里插入图片描述

四、Navicat远程登陆mysql

1、创建用户并受权

CREATE USER 'root'@'%' IDENTIFIED BY 'wangge' ;授权grant all on *.* to 'root'@'%';ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'wangge';刷新flush privileges

在这里插入图片描述

在这里插入图片描述

五、开启防火墙

添加端口

firewall-cmd --zone=public --add-port=3306/tcp --permanent

重启防火墙

systemctl restart firewalld.service

产看端口

firewall-cmd --list-ports

在这里插入图片描述

在这里插入图片描述

六、Navicat连接远程数据库

1、获取ip地址

192.168.0.105

在这里插入图片描述

ssh连接

在这里插入图片描述

常规

在这里插入图片描述

转载地址:http://vmkgf.baihongyu.com/

你可能感兴趣的文章
ORACLE表空间扩张
查看>>
orcal 循环执行sql
查看>>
web.xml配置监听器,加载数据库信息配置文件ServletContextListener
查看>>
结构型模式之桥接模式(Bridge)
查看>>
行为型模式之状态模式(State)
查看>>
行为型模式之策略模式(Strategy)
查看>>
行为型模式之模板方法模式(TemplateMethod)
查看>>
行为型模式之访问者模式(Visitor)
查看>>
大小端详解
查看>>
source insight使用方法简介
查看>>
<stdarg.h>头文件的使用
查看>>
C++/C 宏定义(define)中# ## 的含义 宏拼接
查看>>
Git安装配置
查看>>
linux中fork()函数详解
查看>>
C语言字符、字符串操作偏僻函数总结
查看>>
Git的Patch功能
查看>>
分析C语言的声明
查看>>
TCP为什么是三次握手,为什么不是两次或者四次 && TCP四次挥手
查看>>
C结构体、C++结构体、C++类的区别
查看>>
进程和线程的概念、区别和联系
查看>>