zoukankan      html  css  js  c++  java
  • 【mysql】查看mysql数据库、表使用的引擎及用户管理命令

    查看mysql的存储引擎:  mysql>show engines;   查看默认的搜索引擎: mysql>show variables like '%storage_engine%';   查看某个表用的什么引擎 正确方式一:  SHOW TABLE STATUS from  数据库库名  where Name='表名'; show create table 表名;

    1.远程登录mysql   mysql -h ip -u root -p 密码  

    2.创建用户     格式:grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码";     

    例1:增加一个test1用户,密码为123456,可以在任何主机上登录,并对所有数据库有查询,增加,修改和删除的功能。需要在mysql的root用户下进行      

    mysql>grant select,insert,update,delete on *.* to test1@"%" identified by "123456";      

    mysql>flush privileges;       

    例2:增加一个test2用户,密码为123456,只能在192.168.2.12上登录,并对数据库student有查询,增加,修改和删除的功能。需要在mysql的root用户下进行      

    mysql>grant select,insert,update,delete on student.* to test2@192.168.2.12 identified by "123456";       

    mysql>flush privileges;        

    例3:授权用户test3拥有数据库student的所有权限        

    mysql>grant all privileges on student.* to test3@localhost identified by '123456';       

    mysql>flush privileges;  

    3.修改用户密码       

    mysql>update mysql.user set password=password('123456') where User='test1' and Host='localhost';       

    mysql>flush privileges;  

    4.删除用户     

    mysql>delete from user where user='test2' and host='localhost';    

    mysql>flush privileges;  

    5.删除数据库和删除表    

    mysql>drop database 数据库名;    mysql>drop table 表名;  

    6.删除账户及权限    

    drop user 用户名@'%'     drop user 用户名@localhost

  • 相关阅读:
    回调函数实例
    Java StringBuffer 和 StringBuilder 类
    excel被保护或者锁定时候按住alt和enter可以输入换行
    ArrayUtils.
    excel中在某一列上的所有单元格的前后增加
    decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)
    正则表达式:Pattern类与Matcher类详解
    Cocos2d-x文本菜单
    msp430在ccsv5下出现的问题总结
    与TCP/IP协议的初次见面(一)
  • 原文地址:https://www.cnblogs.com/haifeisi/p/3284915.html
Copyright © 2011-2022 走看看