地址:https://www.codewithharry.com/blogpost/install-phpmyadmin-ubuntu-nginx/
How to install PhpMyAdmin on Ubuntu running Nginx (LEMP stack)
In this post, we will see how to install phpMyAdmin on servers running Nginx. Follow the steps below:
Step 1 - Installing phpMyAdmin
Enter the following command to install PHPMyAdmin
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
Step 2 - Configuring MySQL to use a password
Now we will configure password login to MySQL for logging into PHPMyAdmin
Open MySQL console
sudo mysql
and execute the following query to create a new user to be used for PHPMyAdmin.
CREATE USER 'harry'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'MyStrongPassword1234$';
This creates a new MySQL 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;
Let's exit the MySQL console now
exit
Step 3 - Create a symlink
You’ll now need to create a symbolic link from the PHPMyAdmin files to Nginx’s document root directory. This will tell Nginx where PhpMyAdmin files are and how to serve them!
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
Step 4 - Check the installation
Restart Nginx using the command below:
sudo service nginx restart
Now go to the http://<your-server-ip>/phpmyadmin from your browser and login using the username and password you used in step 2.
You should be able to see the PHPMyAdmin interface.
You should now have phpmyadmin configured on your server. You can use this interface to easily create, manage and update your databases. Happy coding!
标签:PHPMyAdmin,Nginx,phpmyadmin,How,install,MySQL,Copy,minutes From: https://www.cnblogs.com/hechunfeng/p/17464720.html