搜索

数据库配置


发布时间: 2022-11-24 23:17:00    浏览次数:75 次

登录mysql

  • 命令行连接

    • mysql -h 127.0.0.1 -P 3306 -uroot -p
    • mysql -uroot -p 有区别,如果在本地连接,使用这个,速度会快
      image

创建一个库

  • 使用Navicat图形化操作

    image
  • 命令行创建

    create database 【name】 default charset=utf8;

查看用户

  • 5.7之前版本

    select user,host,password from mysql.user;
  • 5.7往后的版本

    select user,host,authentication_string from mysql.user;
    image

创建用户

  • 一键建用户加赋权

    官方已弃用

    grant 权限(create, update) on 库.表 to '账号'@'host' identified by '密码'

    • 举例
      grant all privileges on 【库名】.* to '【用户名】'@'%' identified by 'xxxyyy';
      grant all privileges on 【库名】.* to '【用户名】'@'localhost' identified by 'xxxyyy';
      
  • 分布式建用户

    不仅仅适用8.0,还适用5.7版本

    mysql> create user test@'localhost' identified by '12345678';
    
    mysql> grant all privileges on test.* to test@'localhost';
    
    mysql> flush privileges;
    
免责声明 数据库配置,资源类别:文本, 浏览次数:75 次, 文件大小:-- , 由本站蜘蛛搜索收录2022-11-24 11:17:00。此页面由程序自动采集,只作交流和学习使用,本站不储存任何资源文件,如有侵权内容请联系我们举报删除, 感谢您对本站的支持。 原文链接:https://www.cnblogs.com/al6nlee/p/16923822.html