In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to install phpMyAdmin on Ubuntu18.04, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
We will install phpMyAdmin to work with Apache on Ubuntu18.04.
Before installing phpMyAdmin, you need to have the LAMP stack installed and the web page provided.
If there is no installation, you can refer to install Apache,MySQL,PHP on Ubuntu 18.04 to install it first.
1. Install phpMyAdmin
Let's start by updating the package list and install phpMyAdmin on Ubuntu 18.04. Below we have two commands separated by & &. The first command updates the package list to ensure that you get the latest version and dependencies of phpMyAdmin. The second command downloads and installs phpMyAdmin. When asked to continue, press y and enter.
$sudo apt update & & sudo apt install phpmyadmin
Depending on your settings, the order of the following screens in the phpMyAdmin package configuration may vary.
If prompted to select a web server, press space to place an asterisk [*] next to apache2, then press TAB to highlight OK and press ENTER. As shown below:
After entering the car, please enter as follows:
Select Yes and press ENTER to install and configure the database.
The MySQL application password is used only within phpMyAdmin and is used to communicate with MySQL. You can leave this blank and the password will be generated automatically. Press enter to continue.
two。 Test phpMyAdmin
You should now be able to access the phpMyAdmin web interface by accessing the server's domain name or public IP address and / phpMyAdmin. For example: http://example.com/phpmyadmin or http://192.168.1.10 phpmyadmin
If you don't already have a domain name or don't know your IP, you can find it with the following command:
$sudo service apache2 status
The first time you install MySQL, you need to set the root user and password. However, the root user may disable remote login.
If you get an error "access to user 'root' @ 'localhost' is denied, you should proceed to step 3 to create a superuser for phpMyAdmin."
3. Create a MySQL user
If you cannot log in as the root user above, you can now create a superuser account for phpMyAdmin.
At the terminal, log in to MySQL as the root user. You may have created a root password the first time you installed MySQL
Or the password is blank, in which case you can press ENTER when prompted for the password.
$sudo mysql-p-u root
Now add a new MySQL user with the user name of your choice. In this case, we call it pmauser (php my admin user).
Be sure to replace password_here with your own password (create your own password).
The% symbol tells MySQL to allow the user to log in from anywhere remote. If you want to improve security, you can replace it with an IP address.
CREATE USER 'pmauser'@'%' IDENTIFIED BY' password_here'
The password I set here is 123456. This is a weak password (it is easy to guess). It is not recommended to use this password.
Now we will grant superuser privileges to the new user pmauser.
GRANT ALL PRIVILEGES ON *. * TO 'pmauser'@'%' WITH GRANT OPTION
Exit MySQL now.
Exit
You should now be able to access phpMyAdmin using this new user account.
If you want to set up some extra security for phpMyAdmin, proceed to the next step.
4. Fuzzy phpMyAdmin URL
Robots and attackers keep scanning the web server for the default phpMyAdmin login page, so it is recommended that you change the URL to something else.
In this example, we will change it from example.com/phpmyadmin to example.com/pmahidden.
Use a vi text editor to open the phpMyAdmin configuration file for Apache. (if you are not used to vi, a visual text editor gedit is recommended.)
$sudo ifconfig | grep-Eo 'inet (addr:)? ([0-9] *\.) {3} [0-9] *' | grep-Eo'([0-9] *\.) {3} [0-9] *'| grep-v '127.0.0.1'
Change Alias (alias) from / phpmyadmin to / pmahidden-you can also change it to anything you want.
Save and exit vi.
You must now reload the Apache service for the changes to take effect.
$sudo vi / etc/apache2/conf-available/phpmyadmin.conf
You should now be able to access phpMyAdmin through example.com/pmahidden
5. Protect with .htpasswd
We can use .htpasswd to further protect the phpMyAdmin login page. This adds another line of defense against robots and hackers.
5.1 allowed. Htaccess overlay
To set .htpasswd, we must first change the phpMyadmin Apache configuration file to allow .htaccess overrides.
Open the configuration file phpmyadmin.conf using vi
$sudo vi / etc/apache2/conf-available/phpmyadmin.conf
Add AllowOverride All under DirectoryIndex index.php as shown below:
Save and exit vi
Now reload the Apache service.
$sudo service apache2 reload
5.2 set .htpasswd
We will use the gedit text editor to create a new .htaccess file in the phpMyAdmin installation directory.
$sudo gedit / usr/share/phpmyadmin/.htaccess
Paste the following into the .htaccess file.
AuthType BasicAuthName "Restricted Access" AuthUserFile / etc/phpmyadmin/.htpasswdRequire valid-user
Click the Save button to save and click the close button to exit.
Now we can use the htpasswd tool to generate the .htpasswd file.
In this case, we created a new user named pmauser (php my admin user), although you can change it to anything you want.
$sudo htpasswd-c / etc/phpmyadmin/.htpasswd pmauser
You will be asked to enter a new password twice (generate a password).
When you're done, you can now access phpMyAdmin in your browser, and you should now be prompted for login details.
Thank you for reading this article carefully. I hope the article "how to install phpMyAdmin on Ubuntu18.04" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.