首页 > 系统相关 >5_How to install phpMyAdmin on Ubuntu_

5_How to install phpMyAdmin on Ubuntu_

时间:2023-06-07 22:14:59浏览次数:44  
标签:php Copy Ubuntu will How install MySQL password your

 

地址:https://www.codewithharry.com/blogpost/install-phpmyadmin-ubuntu/

 

 

 

 

Installing phpMyAdmin and adding password authentication to MySQL on Ubuntu

In this video, we will see how to install and secure phpMyAdmin on Ubuntu 20.04. phpMyAdmin was created to easily interact with MySQL databases using a web-based interface. I will assume that you have configured a non-root user on your ubuntu machine and installed the lamp stack.

We will also see how to enable password authentication on MySQL which supports socket-based authentication by default.

 

 

 

Step 1 - Installing PHPMyAdmin 

Let's update our server's package index

sudo apt update

Run the following command to install phpMyAdmin and related packages

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

Using this command we installed the following packages:

  • php-mbstring: A module for managing non-ASCII strings with different encodings
  • php-zip: An extension that facilitates uploading .zip files to phpMyAdmin
  • php-gd: Enables support for GD graphics library
  • php-json: Provides support for JSON serialization
  • php-curl: Allows PHP to communicate with other servers

While installing PHPMyAdmin you will see a prompt that will ask you to select the webserver. Press <Spacebar> <Tab> and then enter key to continue the installation.

 

 

 

You will also be asked to continue with dbconfig-common setup. Press enter to confirm.

Finally, choose and confirm a strong password for PHPMyAdmin. If you get a prompt asking for the services which need to be restarted, simply press the "tab" and then "enter" key to continue. Phpmyadmin is now installed on your Ubuntu server

Step 2 - Configuring password access in MySQL 

to use MySQL we need to enable password login in MySQL. enter the following command to launch the MySQL console:

sudo mysql

 

 

 

Now enter the following query to enable password authentication in MySQL 

ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'MyStrongPassword1234$';

Please make sure you choose your own password and not the one which I chose ('MyStrongPassword1234$')

You can always check the authentication method used by using the following MySQL query:

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

Exit from the MySQL console by typing exit.

Now you can log in using your MySQL password by entering the following command to the MySQL console

sudo mysql -u root -p

 

 

 

Step 3 - Configuring a non-root user in MySQL

Since its not a good idea to use root as your login user, we will create another MySQL user named harry to login to the PHPMyAdmin console:

Execute the following query:

CREATE USER 'harry'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'MyStrongPassword1234$';

This creates a user named harry with the password - 'MyStrongPassword1234$'

Let's provide this user all the privileges so that we can use it to access the PHPMyAdmin console. Execute the query below

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

You can now exit the MySQL shell:

exit

 

 

 

Step 4 - Accessing phpMyAdmin 

Go to the browser and type 'http://your_domain_or_IP/phpmyadmin' in your URL bar. You will see an option to log into your PHPMyAdmin console. Enter the username (harry in my case) and password you chose for this user. 

You will be logged in to PHPMyAdmin.

Enjoy managing your MySQL databases with ease and security. Happy coding!

标签:php,Copy,Ubuntu,will,How,install,MySQL,password,your
From: https://www.cnblogs.com/hechunfeng/p/17464703.html

相关文章

  • 8_How to install LEMP stack on Ubuntu VPS_
     地址:https://www.codewithharry.com/blogpost/lemp-stack-on-ubuntu-20/  HowtoinstallLEMPstack(Linux,Nginx,MySQL,PHP)onUbuntu20.04Inthistutorial,wewillinstalltheLEMPstackontheubuntu20basedserver.LEMPconsistsofLinux,Nginx(pr......
  • 9_How to install phpMyAdmin on Nginx (in 5 minutes)
     地址:https://www.codewithharry.com/blogpost/install-phpmyadmin-ubuntu-nginx/  HowtoinstallPhpMyAdminonUbunturunningNginx(LEMPstack)Inthispost,wewillseehowtoinstallphpMyAdminonserversrunningNginx.Followthestepsbelow:Step1-......
  • 10_How deploy a Django application using Nginx & Gunicorn in Production
     地址:https://www.codewithharry.com/blogpost/django-deploy-nginx-gunicorn/  HowtohostDjangoApplicationusinggunicorn&nginxinProductionInthispost,wewillseehowtousenginxwithgunicorntoservedjangoapplicationsinproduction. Dj......
  • 3_Installing Linux, Apache, MySQL, PHP (LAMP) Stack on Ubuntu 20.04
      地址:https://www.codewithharry.com/blogpost/lamp-stack-ubuntu-20-04/ InstallingLAMPstackonUbuntu20.04in5MinutesThispostwillexplainhowtoinstallLAMPstackonUbuntu20.04.LAMPstackconsistsofthefollowingcomponents:Linux-AnyLi......
  • 4_How to Host Multiple Websites on One Server
     地址:https://www.codewithharry.com/blogpost/host-multiple-websites-ubuntu-vps/  HowtoHostMultipleWebsitesonUbuntuVPS?Anapache2webserverprovidesrobustnessandscalabilityforhostingmultiplewebsitesonyourUbuntuVPS.Thismeansyoucan......
  • Ubuntu和MIUI时间显示秒数字
    Ubuntu(23.04)状态栏的时间显示秒,则需要执行以下命令mango@mango-ubuntu:~/Desktop$gsettingssetorg.gnome.desktop.interfaceclock-show-secondstrue小米手机(MIUI13)要展示时间到分秒可以打开时间悬浮窗功能即可。1.打开手机设置点击更多设置。2.点击页面下方的开发......
  • Ubuntu开始菜单中的程序图标放置位置
    可能放置在以下两个位置中的一个/usr/share/applications~/.local/share/applications.desktop文件的内容#!/usr/bin/envxdg-open[DesktopEntry]Version=1.0Terminal=falseType=ApplicationName=MicrosoftTeamsExec=/opt/microsoft/msedge/microsoft-edge--profile......
  • Ubuntu虚拟机 与 宿主机共享文件夹及拖拽文件
    1、基础版,a、创建共享文件夹,在虚拟机设置下——》选项界面——》共享文件夹,选择总是启用,并且设置宿主机上的共享文件夹,Tips:记得在主机上设置共享文件夹的共享属性;b、设置VMwareTools 2、先进版:文件拖拽,a、删除原有的vmtools:sudoaptautoremoveopen-vm-tools;b、安装源中......
  • 解决Ubuntu 20.04升级后gnome-control-center设置程序无法打开问题
    解决Ubuntu20.04升级后gnome-control-center设置程序无法打开问题Ubuntu20.04系统升级后,发现gnome设置程序无法正常打开了。在终端运行命令查看错误信息,运行以下命令:sudognome-control-center从显示的错误信息可以看出,其调用的一些so文件,需要高版本的libc6,而Ubuntu20.0......
  • 关于ubuntu
    安装软件sudodpkg-i文件名.deb卸载软件ubuntu彻底卸载软件的常用步骤(以googlechrome为例)如果你想从Ubuntu中彻底卸载Google浏览器,你可以用命令行的方式来操作:sudoapt-getpurgegoogle-chrome-stable,这个命令会删除Chrome浏览器的软件包和配置文件。sudoapt-ge......