For easy access to MySQL server, we need phpmyadmin. Following article guides how to install phpmyadmin for Nginx Server in Ubuntu 20.04.
If you have not installed mysql server yet, then follow chapter 7 of this tutorial series. All the chapter list are present below this article.
PHPMyAdmin Installation for Nginx
Login to your Ubuntu 20.04 hosted at cloud hosting with your non root user name and password using Putty Software. (If you have no idea about it, then check second chapter of this tutorial list. All the chapter list is present below this article).
We are going to use following single line command which will install the updates first, then will install the phpmyadmin software package as well.
test@tester:~$ sudo apt update && sudo apt install phpmyadmin
Couple of messages with yes or no option is going to appear. Press y and enter for all the next messages.
Then a dialogue box will appear with a message to select a web server.
Use tab button to navigate among various option and select ‘ok’ using tab button. Then press enter. (Here no option for NGINX available)
Then another dialogue box will appear. It will ask to configure database with db-config?
Select yes and press enter.
Then another dialogue box will appear, it will ask to set mysql application password for phpmyadmin.
You can ignore this. If you wont provide a password then system will generate a password. This password is internally used. If you want then you can create one. Your wish. Then press enter.
After few minutes of processing, finally PHPMyAdmin will be installed successfully.
If you type your IP address of your cloud hosting followed with phpmyadmin in the browser then you will see phpmyadmin login interface.
My IP Address of cloudhosting: 122:xxx:xxx:xx:09
If you have set password for root user access then, you can login. I have suggested above to leave it blank. So if you have followed and left it blank, then system has generated a password for it. You can not login now.
In either case, we must have to create a user and assign root user privileges to it.
Create super User
Super user is just another user who has the power of root user. That means, this new user can create table, drop table, create database, or any power that a root user has.
To create super user, we need to navigate to MySQL command line interface using following command.
test@tester:~$ sudo mysql -u root -p
If you have set password for root user mysql application password, then it will ask to provide the password. And in above I have suggested to skip and if you have followed and skipped, then it wont ask for the password.
myql command line interface will appear.
Lets create a user using following mysql command.
mysql> CREATE USER ‘newuser’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password_code’;
In the above code provide a user name in the place of newuser and provide a strong password in the place of password_code. Mark the single quote. Keep them. Then press enter.
If you do not see any error message then it means new user is successfully created.
This new user is just another user with no power. Lets assign root user power to this new user with following command.
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘newuser’@’localhost’;
After the above command, press enter. If you do not see any error message, then you have successfully created a super user. Now if you login with your new user name and password then you can login to the phpmyadmin interface.
I hope you must have clear understanding of installing PHPMyAdmin for Nginx server in Ubuntu 20.04 at Cloud Hosting.