A time may come where you need to install a MySql Server on you Raspberry Pi. Thankfully, this can be done in just a few easy steps. Follow along and see!
- Update
- Install mariadb-server
- Start the configuration
- Login
1. Update
The first step is to update and upgrade the Pi.
apt-get install update && apt-get install upgrade -y
2. Install Mariadb-Server
Now that the repositories have been updated, we need to install the server itself. This can be done with the following command.
apt-get install mariadb-server
3. Start the Configuration
Now, we need to initialize the configuration. This is where we set the root password. Do not forget this!
mysql_secure_installation
You will be prompted to enter in the root password, or you can leave the password blank. If you leave the password blank, you can select unix_socket authentication instead of the root password. It will also prompt to remove anonymous users. This anonymous access should be removed for security. You will then be prompted for remote access for the root user, and the creation of the default test database.
4. Login
Now is the time to test! Use the following command to log into the server. Make sure that you use the root password you set up in the previous step.
mysql -u root -p