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