How to install your own Ubuntu 20.04 Linux server | Part 9 of 10

linux hetzner cloud virtual server tutorial

In Part 9 of the tutorial we'll install MySQL and phpMyAdmin.

It's recommended that you have read the previous steps of this course. You'll find the overview at the end of this blogpost.

Course ingredients:

18. Install MySQL

First update your installed package:

sudo apt update


Let's install MySQL Server:

sudo apt install mysql-server


You should run the following security script:

sudo mysql_secure_installation


Start MySQL Server to see if it's working:

sudo mysql


And close it again:

exit


If you haven't already you should install the following packages:

sudo apt install php libapache2-mod-php php-mysql



19. Install phpMyAdmin

Let's install phpMyAdmin:

sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

php-mbstring -> mbstring offers multibyte-specific string functions to handle multibyte encodings in PHP. It handles character encoding conversion such as Unicode-based encodings (e.g. UTF-8 and UCS-2). php-zip -> The php-zip extension can read and write into zipped files.
php-gd -> The GD library provides graphics drawing tools for visual images.
php-curl -> CURL (Client URL) is a Linux terminal command for transferring data between servers. It is an open-source data transfer tool with: URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. While running CURL displays a progress bar and other helpful parameters.

!!! WARNING POP-UP !!!
1.) SPACE -> select the option
2.) TAB -> jump to next selection
3.) ENTER -> confirm the pop-up selection


We want to explicitly enable the mbstring extension:

sudo phpenmod mbstring


Restart your apache service:

sudo systemctl restart apache2


Open the MySQL promt:

sudo mysql


Show list of MySQL users:

SELECT user,authentication_string,plugin,host FROM mysql.user; 


Change the authentication for your MySQL user from auth_socket to caching_sh2_password:

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password'; 


Check again to verify your changes:

SELECT user,authentication_string,plugin,host FROM mysql.user; 


Create a new user:

CREATE USER 'yourNewUser'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourPassword'; 


Change authentication method for new user:

ALTER USER 'yourNewUser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourPassword'; 


Grant yourNewUser permissions to change privileges for other users, have access to databases and database commands:

GRANT ALL PRIVILEGES ON *.* TO 'yourNewUser'@'localhost' WITH GRANT OPTION; 


Exit the MySQL promt:

exit 


At this point you should be able to see the admin panel of phpMyAdmin in your browser. Try to login with your credentials:

https://yourDomain/phpmyadmin 


The Course Syllable:

22.05.2021 – Part 1

  1. Introduction & reasoning

29.05.2021 – Part 2

  1. Create Hetzner Cloud Server
  2. Connect to Server

05.06.2021 – Part 3

  1. Update and upgrade Ubuntu installation and install apache2
  2. Install PHP

12.06.2021 – Part 4

  1. Establish ssh keys
  2. Add new sudo user
  3. Deactivate root user
  4. Make new sudo user owner of ssh service

19.06.2021 – Part 5

  1. Buy Domain and point it to Hetzner Server
  2. Create Virtual Host for domain

26.06.2021 – Part 6

  1. Get free Let's Encrypt SSL certificates
  2. Request certificate, active https and force SSL

03.07.2021 – Part 7

  1. Install Git on Remote Server
  2. Create CI/CD user and ssh keys for Gitlab on Remote Server

10.07.2021 – Part 8

  1. Create Gitlab Repository
  2. Establish ssh keys and configure CI/CD

17.07.2021 – Part 9

  1. Install MySQL
  2. Install phpMyAdmin

24.07.2021 – Part 10

  1. Summary of project development workflow
  2. I'll be back – The course update log

See you next week for more

Johnnie

Previous Post Next Post

This site uses cookies to store information on your computer. Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used. ×
Necessary Cookies

Necessary cookies enable core functionality such as page navigation and access to secure areas. The website cannot function properly without these cookies, and can only be disabled by changing your browser preferences.

Analytical Cookies

Analytical cookies help us to improve our website by collecting and reporting information on its usage.

Marketing cookies

We use marketing cookies to help us improve the relevancy of advertising campaigns you receive.

Save