<div dir="ltr"><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 17, 2016 at 11:40 AM, Sujit K M <span dir="ltr"><<a href="mailto:kmsujit@gmail.com" target="_blank">kmsujit@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">On Mon, Oct 17, 2016 at 7:57 AM, N.J. Thomas <<a href="mailto:njt@ayvali.org">njt@ayvali.org</a>> wrote:<br>
> * Sujit K M <<a href="mailto:kmsujit@gmail.com">kmsujit@gmail.com</a>> [2016-10-15 18:42:05+0530]:<br>
>> I was recently looking at databases or infact user who are readonly. I<br>
>> wanted to know whether MySQL on FreeBSD happens to have a write<br>
>> configuration which lets you disable the write part totally.<br>
><br>
> If I understood you correctly, I think what you want is to create a user<br>
> and grant them only read permissions. Here's the syntax for the GRANT<br>
> command:<br>
><br>
>     <a href="http://dev.mysql.com/doc/refman/5.7/en/grant.html" rel="noreferrer" target="_blank">http://dev.mysql.com/doc/<wbr>refman/5.7/en/grant.html</a><br>
><br>
> You can do this at the database or table level.<br>
<br>
I was more interested in making the mysql server itself readonly. The below link<br>
suggested something but I haven't verified it as of yet. I also find<br>
Slaves being<br>
made readonly though not currently advisable in production.<br>
<br>
<a href="https://dev.mysql.com/doc/refman/5.6/en/innodb-read-only-instance.html" rel="noreferrer" target="_blank">https://dev.mysql.com/doc/<wbr>refman/5.6/en/innodb-read-<wbr>only-instance.html</a><br>
<br>
My set of thinking on is on the below lines.<br>
"If we make an Database read only then we need to return 0 in the case of<br>
Insert/Update statements", 0 being the number of records which are inserted.<br>
<br>
______________________________<wbr>_________________<br>
talk mailing list<br>
<a href="mailto:talk@lists.nycbug.org">talk@lists.nycbug.org</a><br>
<a href="http://lists.nycbug.org/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://lists.nycbug.org/<wbr>mailman/listinfo/talk</a><br>
</blockquote></div><br></div><div class="gmail_extra">I was not exactly sure what you meant here. I can think of a few options:<br><br>1) Use mysql-proxy. <a href="https://downloads.mysql.com/archives/proxy/">https://downloads.mysql.com/archives/proxy/</a> You need to do a little bit of coding do do exactly what you want, but many people have expressed they use it to route queries based on application logic.<br><br>2) Setup a user that only has SELECT priv. <br><br>3) Creative replication: You can use things like the blackhole-storage engine in your replication chain. <br><a href="http://dev.mysql.com/doc/refman/5.7/en/blackhole-storage-engine.html">http://dev.mysql.com/doc/refman/5.7/en/blackhole-storage-engine.html</a><br>I do not know exactly how to get at a read only DB using blackhole but you might come up with something that works for you.<br><div><br></div></div></div>