门户网站建设存在的问题和差距,个人简历模板电子版,网站开发使用什么软件,社区网站建设难点文章目录1、原题1.1、英文原题1.2、中文翻译1.3、答案2、题目解析2.1、题干解析2.2、选项解析3、知识点3.1、知识点1#xff1a;mysqldump的--flush-privileges选项3.2、知识点2#xff1a;mysqldump的--all-databases选项3.3、知识点3#xff1a;mysqldump默认不转储的内容…
文章目录1、原题1.1、英文原题1.2、中文翻译1.3、答案2、题目解析2.1、题干解析2.2、选项解析3、知识点3.1、知识点1mysqldump的--flush-privileges选项3.2、知识点2mysqldump的--all-databases选项3.3、知识点3mysqldump默认不转储的内容4、实验4.1、实验14.1.1、实验目的4.1.2、实验前准备4.1.3、实验步骤4.1.4、实验结论5、总结1、原题
1.1、英文原题
You have just created a replication slave from a backup of the master made with mysqldump: mysqldump -u backup -p --all-databases /backups/mysql.sql You try to log in to the slave with the application user, but fail as follows: Mysql -u application -p ERROR 1045 (28000): Access denied for user ‘application’‘localhost’ (using password: YES) The login works on the master. Which two changes to the process can fix the issue? A、After the restore, log in to the database and execute FLUSH PRIVILEGES. B、Add a second dump for the “mysql” database; --all-databases does not include it. C、Use the --grants option to include GRANT statements in the dump. D、Use the --flush-privileges with mysqldump.
1.2、中文翻译
您刚刚从使用mysqldump创建的主服务器备份创建了一个复制从属服务器 mysqldump -u backup -p --all-databases /backups/mysql.sql 您尝试使用应用程序用户登录从属服务器但失败如下 Mysql -u application -p ERROR 1045 (28000): Access denied for user ‘application’‘localhost’ (using password: YES) 对进程的哪两项更改可以解决问题 A、 还原后登录数据库并执行FLUSH PRIVILEGES。 B、 Add a second dump for the “mysql” database; --all-databases does not include it. C、 使用–grants选项在转储中包含GRANT语句。 D、 对mysqldump使用–flush-privileges选项
1.3、答案
A、D
2、题目解析
本题考察mysqldump进行转储备份的细节。
2.1、题干解析
2.2、选项解析
因为mysql的user表被导入但是user表通过update/insert的权限无法立刻生效需要FLUSH PRIVILEGES。所以选项A正确。当导出mysql数据库时可以加上–flush-privileges选项这样恢复数据时可以让数据生效。所以选项D正确。
3、知识点
3.1、知识点1mysqldump的–flush-privileges选项
在转储mysql数据库包含权限表时要添加一个FLUSH PRIVILEGES语句恢复时才能正确恢复而且恢复时也需要足够的权限来执行该语句。
官方参考文档
3.2、知识点2mysqldump的–all-databases选项
mysqldump默认情况下指定哪个数据库就只导出哪个数据库如下所示
mysqldump world world.sql当使用了–all-databases选项mysqlpump会转储所有数据库除了mysqlpump限制中指出的某些例外包括mysql数据库。
mysqlpump --all-databases3.3、知识点3mysqldump默认不转储的内容
mysqlpump默认不转储INFORMATION_SCHEMA、Performance_schema和sys模式。要转储其中任何一个请在命令行中明确地命名它们。你也可以用 --databases 或 --include-databases 选项命名它们。mysqlpump不转储InnoDB CREATE TABLESPACE语句。
4、实验
4.1、实验1
4.1.1、实验目的
1、mysqldump --all-databases会导出哪些数据库会导出mysql模式的哪些表。
4.1.2、实验前准备
已安装并正常运行的MySQL5.7
4.1.3、实验步骤
使用root用户登录创建一个用户名很特殊的用户方便后面的搜索用户名为ixidixixhspxzvwy
mysql CREATE USER ixidixixhspxzvwy IDENTIFIED BY 000000;创建一个名字很特殊的数据库方便后面的搜索数据库名为nsfduapthkiu库内创建一张名字特殊的表表名为eahmhoioynvt插入几条测试数据。
mysql create database nsfduapthkiu;
mysql use nsfduapthkiu;
mysql create table eahmhoioynvt(id INT NOT NULL PRIMARY KEY, name VARCHAR(10));
mysql INSERT INTO eahmhoioynvt VALUES(1,1),(2,2),(3,c);将新创建的库授权给用户ixidixixhspxzvwy
GRANT ALL PRIVILEGES ON nsfduapthkiu.* TO ixidixixhspxzvwy; 查看当前库有哪些模式发现除了自建的nsfduapthkiu模式还有information_schema、mysql、performance_schema和sys这几个模式。
mysql SHOW DATABASES;
--------------------
| Database |
--------------------
| information_schema |
| mysql |
| nsfduapthkiu |
| performance_schema |
| sys |查看mysql模式下有哪些表发现共31张表
mysql USE mysql
mysql SHOW TABLES;
---------------------------
| Tables_in_mysql |
---------------------------
| columns_priv |
| db |
| engine_cost |
| event |
| func |
| general_log |
| gtid_executed |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| innodb_index_stats |
| innodb_table_stats |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| server_cost |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
退出mysql会话回到Linux界面使用mysqldump --all-databases做备份
$ mysqldump --all-databases all_databases.sql对all_databases.sql进行搜索CREATE DATABASE /!32312 IF NOT EXISTS/发现确实会导出两个模式即mysql模式和自建的模式nsfduapthkiu
......
CREATE DATABASE /*!32312 IF NOT EXISTS*/ mysql /*!40100 DEFAULT CHARACTER SET utf8 */;
......
CREATE DATABASE /*!32312 IF NOT EXISTS*/ nsfduapthkiu /*!40100 DEFAULT CHARACTER SET utf8 */;
......对all_databases.sql进行搜索用户名ixidixixhspxzvwy发现确实会导出user表
$ cat all_databases.sql | grep ixidixixhspxzvwy
INSERT INTO user VALUES
......
(%,ixidixixhspxzvwy,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,,,,,0,0,0,0,mysql_native_password,*032197AE5731D4664921A6CCAC7CFCE6A0698693,N,2022-12-09 02:35:38,NULL,N);再仔细查看all_databases.sql会发现mysql模式的31张表都被导出了。
4.1.4、实验结论
mysqldump --all-databases会导出除了information_schema、performance_schema和sys这三个模式以外的所有模式的所有表包括mysql模式的所有表。
5、总结
mysqldump --all-databases会导出除了information_schema、performance_schema和sys这三个模式以外的所有模式的所有表包括mysql模式的所有表。如果想让mysql授权信息在导入后立即生效则导出时要加上–flush-privileges选项或者在导入后登录再执行FLUSH PRIVILEGES。 文章转载自: http://www.morning.jqjnx.cn.gov.cn.jqjnx.cn http://www.morning.rhdln.cn.gov.cn.rhdln.cn http://www.morning.flhnd.cn.gov.cn.flhnd.cn http://www.morning.wfhnz.cn.gov.cn.wfhnz.cn http://www.morning.qzpw.cn.gov.cn.qzpw.cn http://www.morning.lbssg.cn.gov.cn.lbssg.cn http://www.morning.wscfl.cn.gov.cn.wscfl.cn http://www.morning.pmjhm.cn.gov.cn.pmjhm.cn http://www.morning.qtrlh.cn.gov.cn.qtrlh.cn http://www.morning.irqlul.cn.gov.cn.irqlul.cn http://www.morning.jkdtz.cn.gov.cn.jkdtz.cn http://www.morning.xnhnl.cn.gov.cn.xnhnl.cn http://www.morning.nzklw.cn.gov.cn.nzklw.cn http://www.morning.dnqlba.cn.gov.cn.dnqlba.cn http://www.morning.dbxss.cn.gov.cn.dbxss.cn http://www.morning.rykgh.cn.gov.cn.rykgh.cn http://www.morning.fllx.cn.gov.cn.fllx.cn http://www.morning.hmqjj.cn.gov.cn.hmqjj.cn http://www.morning.zypnt.cn.gov.cn.zypnt.cn http://www.morning.bwhcl.cn.gov.cn.bwhcl.cn http://www.morning.trtxt.cn.gov.cn.trtxt.cn http://www.morning.gmwdl.cn.gov.cn.gmwdl.cn http://www.morning.dnbhd.cn.gov.cn.dnbhd.cn http://www.morning.psdbf.cn.gov.cn.psdbf.cn http://www.morning.qggm.cn.gov.cn.qggm.cn http://www.morning.tfpmf.cn.gov.cn.tfpmf.cn http://www.morning.dpgdj.cn.gov.cn.dpgdj.cn http://www.morning.jgncd.cn.gov.cn.jgncd.cn http://www.morning.fbhmn.cn.gov.cn.fbhmn.cn http://www.morning.pjwrl.cn.gov.cn.pjwrl.cn http://www.morning.ccyns.cn.gov.cn.ccyns.cn http://www.morning.cqrenli.com.gov.cn.cqrenli.com http://www.morning.kybyf.cn.gov.cn.kybyf.cn http://www.morning.rrgqq.cn.gov.cn.rrgqq.cn http://www.morning.zmyzt.cn.gov.cn.zmyzt.cn http://www.morning.egmux.cn.gov.cn.egmux.cn http://www.morning.gbrps.cn.gov.cn.gbrps.cn http://www.morning.rzmsl.cn.gov.cn.rzmsl.cn http://www.morning.ssglh.cn.gov.cn.ssglh.cn http://www.morning.knscf.cn.gov.cn.knscf.cn http://www.morning.clfct.cn.gov.cn.clfct.cn http://www.morning.pjwml.cn.gov.cn.pjwml.cn http://www.morning.kfsfm.cn.gov.cn.kfsfm.cn http://www.morning.jrbyz.cn.gov.cn.jrbyz.cn http://www.morning.pljdy.cn.gov.cn.pljdy.cn http://www.morning.slwfy.cn.gov.cn.slwfy.cn http://www.morning.lsmgl.cn.gov.cn.lsmgl.cn http://www.morning.xnkh.cn.gov.cn.xnkh.cn http://www.morning.ldspj.cn.gov.cn.ldspj.cn http://www.morning.gqjzp.cn.gov.cn.gqjzp.cn http://www.morning.bppml.cn.gov.cn.bppml.cn http://www.morning.rqjfm.cn.gov.cn.rqjfm.cn http://www.morning.ryysc.cn.gov.cn.ryysc.cn http://www.morning.gxwyr.cn.gov.cn.gxwyr.cn http://www.morning.fhwfk.cn.gov.cn.fhwfk.cn http://www.morning.rcwzf.cn.gov.cn.rcwzf.cn http://www.morning.gmplp.cn.gov.cn.gmplp.cn http://www.morning.fgsct.cn.gov.cn.fgsct.cn http://www.morning.etsaf.com.gov.cn.etsaf.com http://www.morning.grjh.cn.gov.cn.grjh.cn http://www.morning.skrh.cn.gov.cn.skrh.cn http://www.morning.rpsjh.cn.gov.cn.rpsjh.cn http://www.morning.pwwjs.cn.gov.cn.pwwjs.cn http://www.morning.azxey.cn.gov.cn.azxey.cn http://www.morning.dmldp.cn.gov.cn.dmldp.cn http://www.morning.bfjyp.cn.gov.cn.bfjyp.cn http://www.morning.kzyr.cn.gov.cn.kzyr.cn http://www.morning.jydky.cn.gov.cn.jydky.cn http://www.morning.mstrb.cn.gov.cn.mstrb.cn http://www.morning.srxhd.cn.gov.cn.srxhd.cn http://www.morning.bkqdg.cn.gov.cn.bkqdg.cn http://www.morning.dbxss.cn.gov.cn.dbxss.cn http://www.morning.snxbf.cn.gov.cn.snxbf.cn http://www.morning.wspyb.cn.gov.cn.wspyb.cn http://www.morning.yfpnl.cn.gov.cn.yfpnl.cn http://www.morning.flncd.cn.gov.cn.flncd.cn http://www.morning.qqrqb.cn.gov.cn.qqrqb.cn http://www.morning.jhzct.cn.gov.cn.jhzct.cn http://www.morning.crsnb.cn.gov.cn.crsnb.cn http://www.morning.cjsrg.cn.gov.cn.cjsrg.cn