To some extent, yes.
When it comes to InnoDB, you can choose what rows can get locked. It is not so much a particular setting for the DB Connection. It is a specific query you have to call before doing UPDATEs.
SELECT ... FOR UPDATE
SELECT ... LOCK IN SHARE MODE
This can initiate exclusive or shared row locks based on the result set of those SELECTs.
You can find more on this in the MySQL Documentation.
I wrote easrlier posts on using these:
Aug 08, 2011
: Are InnoDB Deadlocks exclusive to INSERT/UPDATE/DELETE?Jan 02, 2012
: LOCK IN SHARE MODEMar 18, 2012
: select for update gives error on indexed columnMay 09, 2012
: Transaction Lock Timeouts When Updating a RowMay 13, 2012
: Cannot update certain rows in innodb tablesAug 10, 2012
; Similar function NOWAIT in MySQL
With regard to sessions and connections
- Performing
SELECT ... FOR UPDATE
will initiate locks on rows you intend to update and still permit other DB Connections to read. - Performing
SELECT ... LOCK IN SHARE MODE
essentially does the reverse - lock rows for you to read
- prevent connections from doing
SELECT ... FOR UPDATE
- allow SELECTs of the same locked rows