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

  • 相关阅读:
    C#中的接口和类的不同点
    值类型和引用类型的区别?
    时隔两年再次操刀NPOI合并单元格
    二.Docker下安装和运行Mysql
    一.CentOS8下的Docker安装
    .NetCore3.1使用Autofac
    .NET Core 3.1使用Swagger
    数组排序和数组对象排序
    C# 操作Excel , 支持超链接 跳转Sheet 页面,HSSFHyperlink函数
    MVC导入Excel通过NPOI
  • 原文地址:https://www.cnblogs.com/sisul/p/8594776.html
Copyright © 2011-2022 走看看