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

  • 相关阅读:
    iOS书写高质量代码之耦合的处理
    下载历史版本App超详细教程
    iOS-申请邓白氏编码的超详细流程介绍
    AFNetworking之于https认证
    iOS时间问题
    AFNetworking到底做了什么?(二)
    AFNetworking到底做了什么
    iOS7中的ViewController切换
    iOS 视图控制器转场详解
    关于如何写UI及屏幕适配的一些技巧
  • 原文地址:https://www.cnblogs.com/sisul/p/8594776.html
Copyright © 2011-2022 走看看