MySQL DatabaseLesson 47Free preview
MySQL Create DB
This lesson is part of MySQL · All levels
Summary
A new database is created using the CREATE DATABASE command, while the USE is used to select the database to be used by the current session. MySQL also provides the SHOW DATABASES command to view the list of databases available on the server. Adding IF NOT EXISTS creates an error-free command when the database already exists.
Key points
- CREATE DATABASE name_db is creating a new database
- CREATE a database if it doesn't exist... safe to run repeatedly without error
- USE name_db selects active database for the next command
- SHOW DATABASES displays a list of databases on the server
- The sensitive database name depends on the file system and settings of lower_case_table_names
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.