Using the root database user for day-to-day operations is too risky, because this account is too powerful and should only be used for important administration tasks.Ĭlick on the "Privileges" tab for the new database. Near the top you should see the "Create Database" section.Įnter a name for the new database, for example retrofun, and click the "Create" button.Ī good practice when creating a new database is to also define a user specifically assigned to it. Once you access the phpMyAdmin interface, click on the "Databases" tab. Password: the root password that you entered in the docker-compose.yml file.To log in, enter the following credentials: You can open the phpMyAdmin database management tool by typing in the address bar of your web browser. Once the images are downloaded, it should take a few seconds for the containers to be launched, and at that point MySQL should be deployed on your computer and ready to be used. The first time you run this command it will take a while, as Docker has to download the MySQL and phpMyAdmin container images from the Docker Hub repository. Once you have this file saved in your project directory, return to the terminal and run the following command to start your MySQL server: $ docker-compose up -d Edit this line to set a secure password of your liking. This line defines the administrator password for the MySQL server. Note the MYSQL_ROOT_PASSWORD line, which has the value changethis!. The database storage is configured on a separate volume called db-data, to make it possible to upgrade the database container without losing data. This Docker Compose configuration file starts a service called db that runs a MySQL server connected to port 3306 of your computer, plus a second service called admin that runs phpMyAdmin on port 8080. If you would like to follow the instructions below to install MySQL, first install Docker Desktop.Ĭopy the following definitions to a file named docker-compose.yml in your project directory: version: '3' The easiest way to get a SQL database up and running is to use Docker and Docker Compose. This article is an excerpt from my book SQLAlchemy 2 In Practice, where I show how to work with relational databases using Python and the SQLAlchemy library. As a bonus, I will also show you how to set up Python to access your MySQL database. The instructions I'm going to share in this article demonstrate how to install and set up a MySQL server along with the popular phpMyAdmin management application. MySQL is an open-source relational database owned by Oracle Corporation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |