MySQL 版本:5.7.23操作系统:Linux问题描述:只能通过Linux系统账号Root命令行进入数据库,无法使用JDBC,远程连接工具进入数据库。报错:ERROR 1698 (28000): Access denied for user 'root'@'localhost'这个问题明显就是没有开放远程连接授权,所以导致只能使用Linux的Root账号登录。

解决流程

1.找到/etc/mysql/mysql.conf.d/mysqld.cnf文件,在[mysqld]最后面加skip-grant-tables

## The MySQL database server configuration file.## You can copy this to one of:# - "/etc/mysql/my.cnf" to set global options,# - "~/.my.cnf" to set user-specific options.# # One can use all long options that the program supports.# Run program with --help to get a list of available options and with# --print-defaults to see which it would actually understand and use.## For explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients# It has been reported that passwords should be enclosed with ticks/quotes# escpecially if they contain "#" chars...# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs# The following values assume you have at least 32M ram

[mysqld_safe]socket = /var/run/mysqld/mysqld.socknice = 0

[mysqld]## * Basic Settings#user = mysqlpid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockport = 3306basedir = /usrdatadir = /var/lib/mysqltmpdir = /tmplc-messages-dir = /usr/share/mysqlskip-external-locking# 加入的内容,开启跳过权限校验skip-grant-tables## Instead of skip-networking the default is now to listen only on# localhost which is more compatible and is not less secure.bind-address = 127.0.0.1## * Fine Tuning#key_buffer_size = 16Mmax_allowed_packet = 16Mthread_stack = 192Kthread_cache_size = 8# This replaces the startup script and checks MyISAM tables if needed# the first time they are touchedmyisam-recover-options = BACKUP#max_connections = 100#table_open_cache = 64#thread_concurrency = 10## * Query Cache Configuration#query_cache_limit = 1Mquery_cache_size = 16M## * Logging and Replication## Both location gets rotated by the cronjob.# Be aware that this log type is a performance killer.# As of 5.1 you can enable the log at runtime!#general_log_file = /var/log/mysql/mysql.log#general_log = 1## Error log - should be very few entries.#log_error = /var/log/mysql/error.log## Here you can see queries with especially long duration#slow_query_log = 1#slow_query_log_file = /var/log/mysql/mysql-slow.log#long_query_time = 2#log-queries-not-using-indexes## The following can be used as easy to replay backup logs or for replication.# note: if you are setting up a replication slave, see README.Debian about# other settings you may need to change.#server-id = 1#log_bin = /var/log/mysql/mysql-bin.logexpire_logs_days = 10max_binlog_size = 100M#binlog_do_db = include_database_name#binlog_ignore_db = include_database_name## * InnoDB## InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.# Read the manual for more InnoDB related options. There are many!## * Security Features## Read the manual, too, if you want chroot!# chroot = /var/lib/mysql/## For generating SSL certificates I recommend the OpenSSL GUI "tinyca".## ssl-ca=/etc/mysql/cacert.pem# ssl-cert=/etc/mysql/server-cert.pem# ssl-key=/etc/mysql/server-key.pem

保存后,重启服务sudo service mysql restart.

2.无验证进入mysql数据库修改user表中root账号信息,flush privileges;

ckmike@ckmikePC:~$ mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.23-0Ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.

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

mysql use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -A

Database changedmysql update mysql.user set authentication_string=password('账号密码') where user='root';Query OK, 0 rows affected, 1 warning (0.03 sec)Rows matched: 3 Changed: 0 Warnings: 1

mysql update user set plugin="mysql_native_password";Query OK, 1 row affected (0.00 sec)Rows matched: 7 Changed: 1 Warnings: 0

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

mysql quitBye

3./etc/mysql/mysql.conf.d/mysqld.cnf文件,去掉skip-grant-tables,开启校验

4.重启服务

sudo service mysql restart;

至此就搞定了,使用jdbc、非Linux root账号都可以登录了。

Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址:https://www.linuxidc.com/Linux/2018-11/155584.htm

MongoDB 4.0 Sharded Cluster部署 Linux系统下virtuoso数据库安装与使用

linux mysql 无法识别,Linux下MySQL 5.7.23无法远程连接解决方案相关推荐

  1. 字符界面运行mysql_详解linux系列之字符界面下MySQL+apache+php的源代码安装

    详解linux系列之字符界面下MySQL+apache+php的源代码安装 在前面介绍了linux和在字符下安装,下面我来介绍一下程序包的安装. 大家也许都知道在linux安装程序的时候后用rpm包安 ...

  2. VMware虚拟机里centos7下安装mysql5.6并授权远程连接Navicat

    正文内容 这节来安装Mysql5.6,并远程授权连接本地windows的Navicat,可以根据以下步骤安装.此文章为自己收藏,必要时拿出来直接用的,有需要的友友可以查看查看的.文章图片有借助于网络的 ...

  3. 成功解决无法连接到YLMF-201404228CG,在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败

    成功解决无法连接到YLMF-201404228CG,在建立与服务器的连接时出错.在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败 ...

  4. linux mysql数据库优化_MySQL_Linux下MySQL数据库性能调优方法,以下的环境具备一定的代表性 - phpStudy...

    Linux下MySQL数据库性能调优方法 以下的环境具备一定的代表性,可以说是中小企业一般配置和工作环境.希望通过本文能让大家理解Linux下MySQL数据库性能调优方法. 硬件准备环境: 硬盘: 1 ...

  5. linux下mysql的备份_Linux下MySQL的备份与还原

    Linux下MySQL的备份与还原 2.1 备份 [root@localhost ~]# cd /var/lib/mysql (进入到MySQL库目录,根据自己的MySQL的安装情况调整目录) [ro ...

  6. linux下mysql目录结构_linux下mysql安装配置与目录结构

    本节内容: linux下mysql安装与配置.mysql目录结构. 1.准备安装程序(官方网站下载) 服务端:MySQL-server-community-5.1.44-1.rhel4.i386.rp ...

  7. linux mint php mysql_linux mint 下mysql中文支持问题

    一.mysql默认不支持中文,它的server和db默认是latin1编码.所以我们要将其改变为utf-8编码,因为utf-8包含了地球上大部分语言的二进制编码 1.关闭mysql服务 sudo /e ...

  8. linux mysql dump命令_linux下mysql命令

    1.linux下启动mysql的命令: mysqladmin start /ect/init.d/mysql start (前面为mysql的安装路径) 2.linux下重启mysql的命令: mys ...

  9. linux上mysql卸数_Linux下MySQL卸载和安装图文教程

    Linux下MySQL卸载和安装图文教程 发布时间:2020-09-02 08:43:17 来源:脚本之家 阅读:59 作者:伊宇紫 第一次写博客,做了两年的开发,工作之余给自己找点有意义的事做,分享 ...

最新文章

  1. 硬盘序列号怎么查_ITX存储空间不足?外接一个硬盘好了WD Elements 12T开箱简测
  2. 不用sqlDataSet如何从后台数据库中读取数据
  3. JSP简单练习-JSP动作指令
  4. jvm内存溢出分析实践案例:javax.crypto.JceSecurity大量BouncyCastleProvider实例无法被回收
  5. iPhone 12开启5G续航锐减 苹果官方回应了!
  6. 第三讲 配置SCCM客户端并添加角色
  7. swoole mysql 协程_swoole-orm: 基于swoole的mysql协程连接池,简单封装。实现多个协程间共用同一个协程客户端。参考thinkphp-orm...
  8. Linux省级精品课程申报,2016年度省级精品在线开放课程开始申报啦!
  9. eclipse主题颜色的下载与设置
  10. Vulkan入门(9)-渲染和显示.md
  11. 群晖Nas通过jellyfin搭建本地影音库详细全过程(一):通过群晖系统docker容器安装jellyfin影音库服务器
  12. 【文献阅读】MMQA——基于图像、文本和表格的问答(Alon Talmor等人,ICLR,2021)
  13. cpi 计算机体系结构 转移指令,高等计算机体系结构基本概念总结
  14. 工业自动化使用机器视觉检测的优势
  15. PyQt5 Qt 文件对话框QFileDialog 选择图片 在label控件上显示图片
  16. iOS游戏开发之Game Center研究
  17. 用canvas绘制微信小程序海报页面并保存相册-适用微信原生
  18. (环境搭建+复现)CVE-2020-1472 NetLogon 域内提权漏洞
  19. windows系统中安装monkey环境
  20. 阿德莱德大学计算机专业学费,2020年阿德莱德大学计算机科学专业研究生申请条件及世界排名|学费介绍...

热门文章

  1. 初具雏形的UL标准侧重于自主车辆的安全性
  2. 图像合成与风格转换实战
  3. HashMap 的长度为什么是 2 的幂次方?
  4. 女友问粉丝过万如何庆祝,我发万字长文《保姆级大数据入门篇》感恩粉丝们支持,学姐|学妹|学弟|小白看了就懂
  5. android layout组件,Android UI学习 - Linear Layout, RelativeLayout
  6. AttributeError: ‘NoneType‘ object has no attribute ‘span‘
  7. Android 人民币符号在布局中实现的效果不一样的处理方法
  8. spring boot整合spring security笔记
  9. Leetcode812.Largest Triangle Area最大三角形面积
  10. UnixLinux大学教程 读书笔记【1-3章】