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
- Introduction & reasoning
29.05.2021 – Part 2
- Create Hetzner Cloud Server
- Connect to Server
05.06.2021 – Part 3
- Update and upgrade Ubuntu installation and install apache2
- Install PHP
12.06.2021 – Part 4
- Establish ssh keys
- Add new sudo user
- Deactivate root user
- Make new sudo user owner of ssh service
19.06.2021 – Part 5
- Buy Domain and point it to Hetzner Server
- Create Virtual Host for domain
26.06.2021 – Part 6
- Get free Let's Encrypt SSL certificates
- Request certificate, active https and force SSL
03.07.2021 – Part 7
- Install Git on Remote Server
- Create CI/CD user and ssh keys for Gitlab on Remote Server
10.07.2021 – Part 8
- Create Gitlab Repository
- Establish ssh keys and configure CI/CD
17.07.2021 – Part 9
- Install MySQL
- Install phpMyAdmin
24.07.2021 – Part 10
- Summary of project development workflow
- I'll be back – The course update log
See you next week for more
Johnnie