When we have the problem with READ ONLY SQL DATABASE(It can happen while we trying to attach different version database file), first up all we need to make the security of ldf and mdf file to everyone-Full Control.( if not working, do the same for folder and drive in which the database file resides. )
And then simply execute the script
Alter database [readonlydb] set READ_WRITE WITH NO_WAIT
Or use the query without the NO_WAIT option.
Alter database [readonlydb] set READ_WRITE