美文网首页Just programing
MySQL 8 安装完成之后

MySQL 8 安装完成之后

作者: chengchaos | 来源:发表于2020-02-18 22:39 被阅读0次
    mysql-logo_2800x2800_pixels1.png

    原文: MySQL8.0-Hole

    root@localhost [(none)]> show databases;
    ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
    root@localhost [(none)]> set password = password('C1234567');
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    root@localhost [(none)]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    

    mysql8.0 创建用户授予权以及客户端连接错解决方法……

    一、创建用户和授权

    MySQL8.0 创建用户和授权和之前不太一样了,其实严格上来讲也不能说是不一样,只能说更严谨了。MySQL8.0 需要先创建用户和设置密码,然后再进行授权。

    -- 创建用户:
    root@localhost [(none)]> create user 'root'@'%' identified by 'admin123';
    -- 再进行授权:
    root@localhost [(none)]> grant all privileges on *.* to 'root'@'%' with grant option;
    

    二、MySQL8.0 的远程链接

    使用客户端链接会报: Authentication plugin 'caching_sha2_password' cannot be loaded: 找不到指定的模块。

    原因是 MySQL8 之前的版本中加密规则是 mysql_native_password,而在 MySQL8 之后,加密规则是 caching_sha2_password,解决问题方法有两种,一种是升级 navicat 驱动,一种是把 mysql 用户登录密码加密规则还原成 mysql_native_password

    使用第二种方式 :

    -- 修改加密规则 
    root@localhost [(none)]> ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; 
    -- 更新一下用户的密码 
    root@localhost [(none)]> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; 
    -- 刷新权限 
    root@localhost [(none)]> FLUSH PRIVILEGES; 
    

    三 lower_case_table_names

    在 my.cnf 里设置了 lower_case_table_names=1,安装好了之后,启动报错

    2018-01-28T13:24:25.339412+08:00 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('1') and data dictionary ('0').
    

    查看MySQL官方文档,有记录:

    lower_case_table_names can only be configured when initializing the server. Changing the lower_case_table_names setting after the server is initialized is prohibited.

    只有在初始化的时候设置 lower_case_table_names=1 才有效,比如:

    --initialize --lower-case-table-names=1
    

    详见

    https://bugs.mysql.com/bug.php?id=90695

    以上。

    相关文章

      网友评论

        本文标题:MySQL 8 安装完成之后

        本文链接:https://www.haomeiwen.com/subject/uhznfhtx.html