mysql_数据备份和迁移(Windows)

mysql_数据备份和迁移(Windows)
强烈推介IDEA2021.1.3破解激活,IntelliJ IDEA 注册码,2021.1.3IDEA 激活码  

大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说mysql_数据备份和迁移(Windows),希望能够帮助大家进步!!!

1、如何查看mysql用户名的数据库操作权限?

show grants for root@'localhost';

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*6SB4837EB74329105EE4568DDA7DC67ED2CA2AD3' WITH GRANT OPTION
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION

2、如何查看当前数据库的存储引擎?

show engines 

 

3、远程备份

mysqldump --help # 查看帮助

[root@zhangmeng ~]# mysqldump -h192.168.1.1-ubob -p --skip-add-locks test >/root/cp_test.sql
Enter password: 
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database.
 If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events. 

参考指令:

# 备份单个数据库的结构 -d
[root@test ~]# mysqldump -h192.168.1.1 -ubob -p --skip-add-locks test _database  -d>/root/cp_test_struct.sql
# 备份单个数据库的数据  -t
[root@test ~]# mysqldump -h192.168.1.1 -ubob -p --skip-add-locks test _database  -t>/root/cp_test_data.sql

前提先登录数据库
# 恢复结构
[root@test ~]# use test_database;
[root@test ~]#source G:\cp_test_struct.sql
# 恢复数据
[root@test ~]#source G:\cp_test_data.sql

ps:
远程登录指定端口:

# P 指定远程端口,虚拟机和本地端口映射
mysql -uroot -p123 -P8806
本文来源huayang183,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/18305

发表评论