zoukankan      html  css  js  c++  java
  • 13.4 mysql用户管理 13.5 常用sql语句 13.6 mysql数据库备份恢复

    其中,all表示所有的权限(如读、写、查询、删除等操作);.有2个*,前者表示所有的数据库,后者所有的表;identified by后面跟密码,用单引号括起来。这里的user1特指localhost上的user1。

    默认socket连接

    不需要-h也能登陆啦

    show grants;其实看的是root用户的。

    查看指定用户的授权

    如果user2除了要在128上登录,还要在129上登录,那该怎么办?

    select * from mysql.db where host like '192.168.%'G;

     创建表t1;

    [root@lizhipenglinux01 ~]# mysqldump -uroot -paminglinux mysql > /tmp/mysqlbak.sql     数据库备份到/tmp/mysqlbak.sql
    Warning: Using a password on the command line interface can be insecure.

    [root@lizhipenglinux01 ~]# mysql -uroot -paminglinux -e "create database mysql2"            创建数据库mysql2
    Warning: Using a password on the command line interface can be insecure.

    [root@lizhipenglinux01 ~]# mysql -uroot -paminglinux mysql2 < /tmp/mysqlbak.sql             备份的数据库恢复到mysql2
    Warning: Using a password on the command line interface can be insecure.

    登录时所在数据库就是mysql2

    先库后表

    [root@lizhipenglinux01 ~]# mysqldump -uroot -paminglinux mysql user > /tmp/user.sql    备份user表
    Warning: Using a password on the command line interface can be insecure.

    只有库没有表

    [root@lizhipenglinux01 ~]# mysql -uroot -paminglinux mysql2 < /tmp/user.sql       恢复
    Warning: Using a password on the command line interface can be insecure.

    备份所有库

    备份表结构 -d

  • 相关阅读:
    vi/vim经常使用命令
    微信公众平台开发(数据库连接)
    遍历Map的四种方法
    提高日志质量的 5 大技巧
    位运算 的探究
    STL源代码剖析 读书总结
    从一段代码看fork()函数及其引发的竞争
    oc56--ARC多个对象的内存管理
    oc55--ARC单个对象的内存管理
    oc54--auatorelease应用场景
  • 原文地址:https://www.cnblogs.com/sisul/p/8594776.html
Copyright © 2011-2022 走看看