is there some way to do this sql script, in mysql? This script was make in postgres, but I don't find their way to make it in mysql
DO
$do$
BEGIN
  IF EXISTS (SELECT FROM pg_database WHERE datname = 'example_work_db') THEN
    CREATE USER example_work_srv WITH ENCRYPTED PASSWORD 'P4ssw0rd.';
    GRANT CONNECT ON DATABASE example_work_db TO example_work_srv;
    GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO example_work_srv;
  END IF;
  IF EXISTS (SELECT FROM pg_database WHERE datname = 'example_test_db') THEN
    CREATE USER example_test_srv WITH ENCRYPTED PASSWORD 'P4ssw0rd.';
    GRANT CONNECT ON DATABASE example_test_db TO example_test_srv;
    GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO example_test_srv;
  END IF;
  IF EXISTS (SELECT FROM pg_database WHERE datname = 'example_live_db') THEN
    CREATE USER example_live_srv WITH ENCRYPTED PASSWORD 'P4ssw0rd.';  
    GRANT CONNECT ON DATABASE example_live_db TO example_live_srv;
    GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO example_live_srv;
  END IF;
END
$do$;

Thank you in advance for the help
You should only change create and grant statements, everything else is ok.
CREATE USER example_work_srv IDENTIFIED BY 'P4ssw0rd.';
GRANT SELECT, INSERT, UPDATE ON public.* TO example_work_srv;