zoukankan      html  css  js  c++  java
  • MySQL命令行基本命令操作

    进入命令模式后,

    显示所有数据库

    show databases;
    

     选定某个数据库

    use 数据库名;
    

     创建数据库

    create database  数据库名;
    

     删除数据库

    drop table 数据库名;
    

     显示数据库的所有表

    show tables;
    

     创建表

    create table 表名;
    

     删除表

    drop table 表名;
    

     清空表

    delete table 表名;
    

     查看表内容

    select * from 表名;
    

     查看某个表的具体表结构

    describe 表名;
    

     修改表内容的值

    update 表名 set 参数名=要改成的值 where 参数名=某个值;
    

     查看存储过程

    show procedure status;
    

    查看存储过程的具体内容

    show create procedure 存储过程名
    

    创建用户

    grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码"
    

    用户已存在赋予权限

    grant select,insert,update,delete  on 数据库.* to 用户名@登录主机 identified by "密码"
    

    当然,权限有14种权限

    select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process
    

    不设置用户密码的话

    grant select,insert,update,delete  on 数据库.* to 用户名@登录主机 identified by ""
    

    删除用户

    drop user 用户名;
    

     查询所有用户

    select user from mysql.user;
    

    查看当前用户

    select user();
    

    查询时间

    select now();
    

    查询数据库版本

    select version;
    

    查询当前选定的数据库

    select database();
    

    参考 http://blog.csdn.net/wangbofei/article/details/11357181

  • 相关阅读:
    poj3436(ACM Computer Factory)
    一位ACMer过来人的心得
    poj1459(Power Network)
    (转)网络流—最大流(Edmond-Karp算法)
    poj1611(The Suspects)
    构建之法阅读笔记01
    第三周总结
    全国疫情可视化地图
    第二周总结
    作业--数组(大数)
  • 原文地址:https://www.cnblogs.com/JAYIT/p/5016688.html
Copyright © 2011-2022 走看看