mysql-備份和恢複

來源:互聯網
上載者:User

標籤:and   mysq   creat   備份   tab   .sql   rom   style   where   

Database Backup:    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表中的一條記錄

 

mysql-備份和恢複

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.