zoukankan      html  css  js  c++  java
  • mysql-备份和恢复

    数据库备份:
        mysqldump -u user_name -p password database_name >file_name.sql
        
    数据库还原:
        法一:
        ① 创建数据库:
        ② 还原:mysql -u user_name -p password database_name < file_name.sql(全路径)
        法二:
           还原:source file_name.slq(全路径)  将数据库还原到当前数据库
           
    创建用户:(必须在root中才能创建用户)
        法一:
        create user 'user_name'@'localhost' identified by 'password';
        法二:直接操作user表
        insert into mysql.user(Host,User,authentication_string,ssl_cipher,x509_issuer,x509_subject) 
        values ('localhost','user_name',PASSWORD('password'),'','','');  操作以后必须 flush privileges
            
    删除用户:
         法一:
         drop user 'user_name'@'localhost';
         法二:直接操作user表
         delete from mysql.user where host='localhost' and user='user_name';
         删除以后必须flush privileges(刷新权限)
             
    修改用户密码:
         法一:
         mysqladmin -u user_name -pold_password password new_password;
         法二:要先登录用户
         set password=new_password; 在root用户登录的时候
         法三:先登录root用户,直接操作user表中的authentication字段来修改密码
         update mysql.user set authentication_string=PASSWORD('password') where host='localhost' and user='user_name';
         法四:普通用户在登录到当前用户下,修改当前
         set password=password('new_password');
         set password for 'user_name'@'localhost'=password('new_password');
         
    刷新:
        flush privileges;(直接操作user表的都要flush privileges)
        
        每一个用户资料都是user表中的一条记录
  • 相关阅读:
    一些常用的正则表达式
    ASP.net国际化页面可以选择输出语言
    SQL 2008 数据表导入到 ORACLE 10g
    转载 SQL Server 2008中增强的汇总技巧
    类似于行转列的一种需求
    第一次
    很奇怪的一个SQL 语句
    MS SQL 中 FULL JOIN 的用法
    [转载]网络编辑必知常识:什么是PV、UV和PR值 zz
    寒假学习2实验一Linux系统的安装和常用命令
  • 原文地址:https://www.cnblogs.com/oural-yan/p/6952558.html
Copyright © 2011-2022 走看看