zoukankan      html  css  js  c++  java
  • Mysql常用命令

    grant all privileges on *.* to ‘monitor’@’192.168.1.252’ identified by ‘cciechao’ with grant option;

    查询连接数

    select SUBSTRING_INDEX(host,’:’,1) as ip , count(*) from information_schema.processlist group by ip;

    查看用户权限

    show grants for ‘baobiao’@’172.18.100.239′;

    Flush privileges;(更新权限)

    导出数据和表结构:

    mysqldump -u用户名 -p密码 数据库名 > 数据库名.sql

    #/usr/local/mysql/bin/   mysqldump -uroot -p abc > abc.sql

    敲回车后会提示输入密码

    2、只导出表结构

    mysqldump -u用户名 -p密码 -d 数据库名 > 数据库名.sql

    #/usr/local/mysql/bin/   mysqldump -uroot -p -d abc > abc.sql

    导入数据库

    1、首先建空数据库

    mysql>create database abc;

    2、导入数据库

    方法一:

    (1)选择数据库

    mysql>use abc;

    (2)设置数据库编码

    mysql>set names utf8;

    (3)导入数据(注意sql文件的路径)

    mysql>source /home/abc/abc.sql;

    方法二:

    mysql -u用户名 -p密码 数据库名 < 数据库名.sql

    #mysql -uabc_f -p abc < abc.sql

    查询数据库     查询表      查询表指定内容

    Show databases;  show tables;  select * from tablename where name=name;

    创建库         创建表      插入数据

    Create database  create table   insert into tablename values ()

    修改表内容

    Update tablename set xx=yy where xx=yy;

    删除数据库删除表 删除表内容

    Drop database name   drop table name   delelte from tablename where xx=yy;

    查看mysql连接数

    select SUBSTRING_INDEX(host,’:’,1) as ip , count(*) from information_schema.processlist group by ip;

    查看当前最大连接数

    show variables like ‘max_connections’;

    设置mysql最大连接数

    set global max_connections=10;

  • 相关阅读:
    FCKeditor 2.3 在ASP.NET中的设置和使用
    如何去掉重复记录的Sql语句写法
    asp.net如何去掉HTML标记
    Asp.net中如何删除cookie?
    怎样得到select所有option里的值
    HttpModule是如何工作的
    Asp.net2.0下的表单验证Cookieless属性
    FreeTextBox实现机制
    ajax实现动态从数据库模糊查询显示到下拉框中(ajax方法返回Dataset的例子)
    新浪博客自动发表程序,请勿用于非法用途
  • 原文地址:https://www.cnblogs.com/chaoe/p/7606657.html
Copyright © 2011-2022 走看看