MySQL Read vs Write Lock

I’d like for a client session to lock a table, so that it can continue to read from and write to that table. At the same time other client sessions should only be able to read from the table. Once the lock is removed, then all client sessions should be allowed to read from and write to the table. Also once the lock is removed, all client sessions that tried to write to the table while it was locked should execute. I don’t want any errors thrown on attempted inserts during the lock.

MySQL Read vs Write Lock

I’d like for a client session to lock a table, so that it can continue to read from and write to that table. At the same time other client sessions should only be able to read from the table. Once the lock is removed, then all client sessions should be allowed to read from and write to the table. Also once the lock is removed, all client sessions that tried to write to the table while it was locked should execute. I don’t want any errors thrown on attempted inserts during the lock.

MySQL Locking scenarios

We have a large table of about 100 million records and 100+ fields and there are frequent select and update queries running related to this table.
Now we have a requirement to set almost 50+ fields to null and we are planning to do this updation based on the primary key.
We are aware that there will be a locking mechanism when two updates are trying to update the same record.

How MVCC works with Lock in MySql?

I know that using the locks or MVCC in Mysql can achieve concurrency control, such as repeatable-reading. But I don’t know how MVCC avoids phantom-reading. In other places, I learned that it is generally implemented through MVCC and Gap-Lock, but what I currently understand is that MVCC does not need locks, that is, both updates and deletions are implemented using undo-logs. If so, how do MVCC and the lock mechanism work together?