简体   繁体   English

数据库,用户创建是否在MySql上复制?

[英]Is database, user creation replicated on MySql?

I am deploying new application, I 'm using mysql 5.6 我正在部署新的应用程序,我正在使用mysql 5.6

I setup database replication (master/slave). 我设置数据库复制(主/从)。

I have a question: Are tasks like database creation, User creation replicated to slave? 我有一个问题:是否将诸如数据库创建,用户创建之类的任务复制到从属服务器? Do I have to create the database on each slave, or the replication will create them? 我是否必须在每个从站上创建数据库,否则复制将创建它们? do i have to create the user on each server or the operation will be replicated automatically? 我是否必须在每台服务器上创建用户,否则操作将自动复制?

Thanks 谢谢

Yes and No

the reason how do you config the replication. 您如何配置复制的原因。 there are many things in the configuration like ignore DB, ignore table and so on. 配置中有很多东西,例如忽略数据库,忽略表等等。

If nothing set all schemas, tables, views and so on are created and modifyed by the Master. 如果没有设置,则所有模式,表,视图等都将由主服务器创建和修改。

So you CANT create a Schema,table or User on the SLAVE and later you create them on the Master. 因此,您不能在SLAVE上创建Schema,表或用户,然后在Master上创建它们。 then the replication will stops with error. 那么复制将因错误而停止。

Replication should not include permission. 复制不应包含权限。 Applications using master and slave should use different credentials and privileges to be always secure. 使用主服务器和从服务器的应用程序应使用不同的凭据和特权,以始终保持安全。

For eg, if I have a click-stream application, in master I will use clicker user with writes while slave will be used by a reporting tool with read-only with user name like clicker-ro or analyticsro. 例如,如果我有一个点击流应用程序,则在主服务器中,我将使用带有写入功能的Clicker用户,而从属服务器将由具有只读用户名(例如clicker-ro或analyticsro)的报告工具使用。 When I mean secure, a member of analytics should never have access to master db( to avoid writes and to avoid heavy queries in master) 我的意思是安全时,分析成员永远都不能访问主数据库(以避免写操作并避免在主数据库中进行繁重的查询)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM