To create a MySQL database and user, follow these steps: At the command line, log in to MySQL as the root user: mysql -u root -p; Type the MySQL root password, and then press Enter. To create a database user, type the following command..