zoukankan      html  css  js  c++  java
  • macOS + MySql8 问题

    最近mac 升级安装mysql后遇到一系列问题,稍作记录。

    1、升级8以后,使用sequelpro 连接报错

    MySQL said: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/mysql/lib/plugin/caching_sha2_password.so, 2): image not found

    原因: caching_sha2_password, 是mysql8.0的一个新特性, 默认使用该身份认证插件进行加密. 但是一些客户端, 诸如sequel pro, Navicat 不支持这种插件, 这个时候就会出现如上错误。

    解决方法:

    1. 在终端登录mysql -u root -p账户密码
    2. 修改登陆账户,使用mysql_native_password加密密码

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';

    2、使用sequelpro连接mysql 后,查看数据库,或者切换数据库,始终在loading ,出现一种假死状态。

    原因:mysql8.0升级后造成的。

    解决方法:    https://sequelpro.com/test-builds, 升级版本sequelpro,先使用测试版。

    3、无法使用远程连接

    原因:MySQL默认绑定了ip:127.0.0.1。

    解决方法:

    1. 修改ip绑定  

    #修改配置文件
    vi /usr/local/etc/my.cnf
    
    #注释掉ip-address选项
    [mysqld]
    # Only allow connections from localhost
    #bind-address = 127.0.0.1

      2. 将登陆账号host设置为%

     首先了解一下mysql.user 表

    ~ » mysql -uroot -p                                                                                                   
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 19
    Server version: 8.0.19 Homebrew
    
    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 user,Host,authentication_string,plugin from user;
    +------------------+-----------+------------------------------------------------------------------------+-----------------------+
    | user             | Host      | authentication_string                                                  | plugin                |
    +------------------+-----------+------------------------------------------------------------------------+-----------------------+
    | test             | %         | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29                              | mysql_native_password |
    | test0            | %         | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9                              | mysql_native_password |
    | mysql.infoschema | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | mysql.session    | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | mysql.sys        | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
    | root             | localhost | $A$005$J})udp=0Q2mo/U/lyljEgy6h0gn3lUxydvreeLg.qJ5QJp7BwlSA4ttZ40 | caching_sha2_password |
    +------------------+-----------+------------------------------------------------------------------------+-----------------------+
    6 rows in set (0.00 sec)
    Host字段中% 表示允许任何ip地址访问,localhost只允许本地访问。
    plugin表示密码加密方式。

    故,若想使用远程访问,修改user表Host字段即可,修改方法有以下几种。

      A、直接update user set Host='%' where user = 'test';
      B、mysqladmin -u root password “newpass”


    参考文献:
    https://ken.io/note/macos-mysql8-install-config-tutorial
    https://dev.mysql.com/doc/refman/8.0/en/alter-user.html
    https://www.cnblogs.com/linjiqin/p/5270938.html



  • 相关阅读:
    stm32之watchdog
    stm32之PWM
    stm32之GPIO(二)
    JavaScript之怎样获取元素节点
    JavaScript之对象学习
    JavaScript之数组学习
    Jquery遍历数组之$.inArray()方法介绍
    Jquery 遍历数组之$().each方法与$.each()方法介绍
    C# 移位运算符
    tensorboard简单使用
  • 原文地址:https://www.cnblogs.com/unicorn2105/p/12321210.html
Copyright © 2011-2022 走看看