postfix how to setup local domain users as virtual users

How can I set up local domain users as virtual users? I have setup virtual domain and the users but when I sent an email it keeps telling me "User not found". To test to see what the problem is, I sent an email to a non existent user of a virtual domain and the error was "Virtual mailbox not found". I need to find a way to be to simulate the local domain as a virtual, so it reads the users from the database? Here is the postfix configuration:

## SASL
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes

## SSL/TLS
#smtpd_tls_security_level = may
smtpd_tls_received_header = yes
smtpd_tls_auth_only = yes
smtpd_tls_cert_file=/etc/postfix/ssl/smtpd.cert
smtpd_tls_key_file=/etc/postfix/ssl/smtpd.key
smtpd_tls_ask_ccert = yes
smtpd_use_tls=yes
smtp_use_tls=yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_session_cache_timeout = 3600s
smtp_tls_protocols = SSLv3, TLSv1
tls_random_source = dev:/dev/urandom


## Restrictions
message_size_limit = 30720000
smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname

smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, 
    reject_unauth_destination

smtpd_data_restrictions = reject_unauth_pipelining

smtpd_sender_restrictions = reject_unknown_sender_domain

smtpd_banner = $myhostname ESMTP $mail_name

## Network
mydestination = $mydomain, $myhostname, localhost
mynetworks = 127.0.0.0/8
inet_interfaces = all

## Virtual
virtual_transport = lmtp:unix:private/dovecot-lmtp
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_alias_maps = mysql:/etc/postfix/mysql/virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_domain_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf

## DKIM
milter_protocol = 2
milter_default_action = accept
smtpd_milters = inet:localhost:12301
non_smtpd_milters = inet:localhost:12301

and dovecot configuration:

#10-auth.conf
disable_plaintext_auth = yes

#auth_cache_size = 0
#auth_cache_ttl = 1 hour
#auth_cache_negative_ttl = 1 hour

#auth_debug_passwords = yes

#auth_realms =

#auth_default_realm = 

auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@

#auth_username_translation =

#auth_username_format = %Lu

#auth_master_user_separator =

#auth_anonymous_username = anonymous

#auth_worker_max_count = 30

#auth_gssapi_hostname =

#auth_krb5_keytab = 

#auth_use_winbind = no

#auth_winbind_helper_path = /usr/bin/ntlm_auth

#auth_failure_delay = 2 secs

#auth_ssl_require_client_cert = no

#auth_ssl_username_from_cert = no

auth_mechanisms = plain login

passdb {
    driver = sql
    args = /etc/dovecot/dovecot-sql.conf.ext
}

userdb {
    driver = sql
    args = /etc/dovecot/dovecot-sql.conf.ext
#   args = uid=5000 gid=5000 home=/var/vmail/%d/%n allow_all_users=yes
}

#dovecot-sql.conf.ext

default_pass_scheme = SHA512-CRYPT

password_query = SELECT username AS user, password, \
    homedir AS userdb_home, uid AS userdb_uid, gid AS userdb_gid \
        from mailbox where username = '%u' and active=1

user_query = \
  SELECT homedir, uid, gid \
  FROM mailbox WHERE username = '%u' and active=1

The messages do get sent to the virtual domains but they don't get sent to the local domain and I get the following warning:

postfix/trivial-rewrite[18548]: warning: do not list domain example.tld in BOTH mydestination and virtual_mailbox_domain

I want all my users to be setup through mysql and the directories were created under /var/vmail/%d/%u, which only works for the virtual domains for now.

EDIT: Added details


Solution 1:

I found an answer to my own question. The problem was that the domain name was in mydestination, which made the emails sent through the domain to go through local_recipients_maps. Removing the domain solved the problem. I don't know if that's the best practice or overriding local_recipients_maps to use mysql is. If anyone has an answer to that please write it in the comment.