Check if the database exists in MySQL.

You can use the following SQL query to check if the database exists:

SHOW DATABASES LIKE '数据库名称';

Replace “database name” in the above code with the name of the database you want to check. If the query returns a result set containing the database, it means the database exists; if the query returns an empty result set, it means the database does not exist.

bannerAds