SQLite3 is an embedded database but lack of complete secure access control mechanism. To solve this problem, this paper first designs a multi-level role function, then makes an analysis of the specific methods and steps of the access control mechanism for SQLite3 based on the RBAC model and combined with the source code of the SQLite3 database. Finally, it makes a detailed design and implementation of this access control mechanism for SQLite3. It is indicated by the experimental tests that the new secure access control mechanism not only succeeds the original advantages of SQLite3, but also improves the security of SQLite3.