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

    MySql常用命令

    #----设置root用户密码----

    > mysqladmin -u root -p password

    > Enter password

    #----登录----

    登录:

    > mysql -u root -p

    > root

    远程连结:

    > mysql -h 192.168.0.201 -P 3306 -u root -p123

    #----创建----

    创建数据库

    > create database dbname;

    创建用户

    > create user username identified by ‘password’;

    给用户授权

    > grant privileges on databasename.tablename to username@“localhost” identified by “password”;

    > flush privileges;

    exp: grant all on wechato2o.* to lio5n@“localhost” identified by “lio5n”;

    #----查看----

    查询数据库

    > show databases;

    查询表

    > show tables;

    查看所有用户

    > select user, host from mysql.user;

    查看某个用户的权限

    > show grants for root@localhost;

    查看当前用户

    > select user();

    > select current_user();

    查看当前数据库

    > select database();

    #----使用----

    使用数据库

    > use databsename;

    使用SQL文件

    > source /…dir…/filename

    导出建表语句

    $ mysqldump -u root -p dbname > ./filename.sql

    $ root

    关闭外键引用检查

    set foreign_key_checks=off;

  • 相关阅读:
    linux 通配符
    linux 常用快捷键
    datatables-2
    datables
    datatables
    http://blog.csdn.net/heqingsong1/article/details/8540665
    软件提升知识点
    深入浅出单实例Singleton设计模式
    详解js跨域问题
    自定义控件之绘图篇(四):canvas变换与操作
  • 原文地址:https://www.cnblogs.com/wanggs/p/5034554.html
Copyright © 2011-2022 走看看