We provide a simple solution to the $\mu$ and strong CP problems in the context of gauge mediated supersymmetry breaking. The generic appearance of R symmetry in dynamical supersymmetry breaking is used to implement Peccei-Quinn symmetry. Acceptable $\mu$ and $B$ terms as well as the large symmetry breaking scale are induced in the presence of nonrenormalizable interactions. Cosmological consequences of this scheme turn out to yield constraints on the PQ symmetry breaking scale and the number of the messenger/heavy quarks. Complexity in introducing non-R Peccei-Quinn symmetry is contrasted with the case of R symmetry.