首页 > 数据库 >CentOS7上的Mysql8.3允许远程连接

CentOS7上的Mysql8.3允许远程连接

时间:2024-04-30 22:12:09浏览次数:31  
标签:Mysql8.3 CentOS7 user mysql MySQL password root 远程 localhost

点击查看代码
[root@clone2 ~]# mysql -uroot -p

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.3.0 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Peng!3!4' WITH GRANT OPTION;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'Peng!3!4' WITH GRANT OPTION' at line 1
mysql> 
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY "Peng!3!4" WITH GRANT OPTION;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY "Peng!3!4" WITH GRANT OPTION' at line 1
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+

| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
| localhost | root             | mysql_native_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)

mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> select host,user,plugin from user;
+-----------+------------------+-----------------------+
| host      | user             | plugin                |
+-----------+------------------+-----------------------+
| %         | root             | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session    | caching_sha2_password |
| localhost | mysql.sys        | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
[root@clone2 ~]# exit
登出
Connection to clone2 closed.
[root@clone1 apache-hive-3.1.3-bin]# mysql -uroot-p -h 192.168.10.12
ERROR 1045 (28000): Access denied for user 'root-p'@'clone1' (using password: NO)
[root@clone1 apache-hive-3.1.3-bin]# mysql -uroot -p -h 192.168.10.12
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.3.0 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye

标签:Mysql8.3,CentOS7,user,mysql,MySQL,password,root,远程,localhost
From: https://www.cnblogs.com/used-conduit-onion/p/18168775

相关文章

  • Java实现自定义指标数据远程写入Prometheus
    主要的流程如下:1>prometheus添加启动参数2>调用http请求来远程写,数据格式是protobuf(一种自定义的编码格式),编码格式是snappy(一种压缩格式)3>远程写通过snappy先压缩,然后将通过protobuf编码的字节数组发送请求;prometheus官网文档远程写提供remote.proto(包含编码和解码),remote.pr......
  • CentOS7安装NVIDIA GPU驱动程序和CUDA工具包
      1.查看本地环境检查GPU型号lspci|grep-invidia查看linux系统版本uname-m&&cat/etc/redhat-release禁用nouveaulsmod|grepnouveau#打开如下文件sudovim/usr/lib/modprobe.d/dist-blacklist.conf#写入以下内容blacklistnouveauoptionsnouveaumodes......
  • centos7数据盘挂载/硬盘挂载/磁盘挂载
    挂载命令:1、数据盘挂载命令:用“lsblk”命令看数据盘信息,确定设备文件名如:dev目录下的vdb。2、执行fdisk/dev/vdb,按界面提示依次输入“n”(新建分区)、“p”(新建扩展分区)、“1”(使用第1个主分区),两次回车,输入“w”(保存分区表),完成后分区vdb1创建完成。3、使用命令对新分区......
  • 交换机统一监控和远程控制:自动发现、自动监控、自动告警、自动修复
        交换机在网络架构中占据重要位置,连接各种设备和系统起到桥梁的作用,控制数据流动,使网络数据传输更加稳定高效。因此,交换机的状态必将影响网络的可靠性和可用性。    北京智和信通交换机管控方案统一纳管网络中不同类型、不同品牌、不同型号的交换机,通过远程监......
  • Spring WebFlow 远程代码执行漏洞(CVE-2017-4971)
    SpringWebFlow远程代码执行漏洞(CVE-2017-4971)SpringWebFlow是一个适用于开发基于流程的应用程序的框架(如购物逻辑),可以将流程的定义和实现流程行为的类和视图分离开来。在其2.4.x版本中,如果我们控制了数据绑定时的field,将导致一个SpEL表达式注入漏洞,最终造成任意命令执行。......
  • 远程访问及控制
    目录1.SSH远程管理(1)配置OpenSSH服务端(2)使用SSH客户端程序(3)密钥对验证的SSH体系(1)SSH的验证方式(2)ssh密钥对的创建和使用(3)ssh密钥对免交互登录2.TCPWrappers访问控制(1)TCPWrappers概述(2)TCPWrappers访问策略(1)TCPWrappers机制的保护对象为各种网络服务程序,针对访问服务的客户端地址......
  • 麒麟系统下安装向日葵远程控制
    1、进入贝锐向日葵网站:https://sunlogin.oray.com/2、点击个人版下载,进入下载页面,选择麒麟,根据cpu类型下载Arm64位3、根据安装命令安装即可,如把下载的安装文件放在了个人目录下file:///home/wqz/SunloginClient_11.0.1.44968_kylin_arm.deb,进入目录file:///home/wqz,右键......
  • git创建远程分支并关联本地分支
    git创建远程分支并关联本地分支:https://blog.csdn.net/longfeng995/article/details/128478961?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171437550516800188597320%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=171437550516800......
  • linux系统 centos7禁止root账号登录
    没有账号的新增账号:sudouseradd-m账号名称sudopasswd账号名称执行完上面命令会让你输入密码输入密码:xxxxxxx1、(注意:禁止root账户登陆前确保有其他账户可以正常使用)编辑配置文件`/etc/ssh/sshd_config`,将`PermitRootLoginyes`改为`PermitRootLoginno`  2、执......
  • centos7 部署 fail2ban
    fail2ban介绍Fail2ban的主要作用是监控系统日志文件,检测恶意的登录尝试,并采取措施来防止进一步的攻击。它通过动态地更新防火墙规则或者调整其他服务的配置,来限制恶意IP的访问。fail2ban部署fail2ban部署sudoyuminstallepel-releasesudoyuminstallfail2banfail2......