how to list databases in mysql code example Example 1: mysql list databases SHOW DATABASES; Example 2: mysql get db name SELECT DATABASE();