zoukankan      html  css  js  c++  java
  • MYSQL8 常用操作

    • 开启root账号远程访问

      方法1

    mysql> CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123123'; //修改密码认证方式为mysql_native_password
    mysql> GRANT ALL ON *.* TO 'root'@'%';

      方法2

    mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123123'; //默认的密码认证插件 caching_sha2_password
    mysql> GRANT ALL ON *.* TO 'root'@'%';
    mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123123';
    • 创建数据库
    mysql> CREATE database IF NOT EXISTS meeting;
    • 创建账号
    mysql> CREATE USER meeting IDENTIFIED BY 'pass123';
    • 授权
    # 下面这个缺少 create index 权限、select 权限等,应该赋权限 ALL
    mysql>
    GRANT EXECUTE,SELECT,INSERT,UPDATE,DELETE,DROP,CREATE,DROP,ALTER ON meeting.* TO 'meeting'@'%' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES;
    • 修改密码
    mysql> ALTER USER 'meeting'@'%' identified with mysql_native_password by 'pass456';
    • 特别注意
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123';
    ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'
    如遇上以上问题请使用update语句先清空authentication_string字段,然后再修改密码即可
    
    
    mysql> UPDATE user SET authentication_string='' WHERE USER='root'; 
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
    最新使用的创建用户及授权 
    CREATE USER hrofferuser IDENTIFIED BY '123456';
    
    flush PRIVILEGES
    
    GRANT ALL ON `hr-offer`.* TO 'offeruser'@'%' WITH GRANT OPTION;
    
    revoke all on eic.* from 'offeruser'@'%'; 
  • 相关阅读:
    科技小论文
    一线架构—细化架构
    python20.04.10
    软件架构总结
    信息领域热词分析
    架构即未来阅读笔记二
    构架即未来阅读笔记一
    科技小论文之软件质量
    Pre-architecture的需求
    软件质量
  • 原文地址:https://www.cnblogs.com/doraman/p/11116012.html
Copyright © 2011-2022 走看看