This article is sponsored by Ilanniweb, starting in Slime Line the world
Want to get more articles, you can follow my ilanniweb
In fact, this article has long wanted to write, but has not had the time. It was just a little bit empty this afternoon, so I sorted out this article.
About phpMyAdmin article, in Baidu a search, can search out a lot. In this article I will introduce how to control the operation of the database by the phpMyAdmin of the developer.
Of course, the security of the database, we can consider from three aspects:
1), MySQL database server, including the security of the server itself, and so on.
2), MySQL access rights, including database user rights, and access to database methods.
3), after the MySQL database access security, including whether to allow the export of data and so on.
Today we use phpMyAdmin to control the operation of the database by developers, in fact, the 2nd and 3rd to prohibit users from accessing the database after exporting data.
First, phpMyAdmin installation
First of all we have to install phpMyAdmin, where we use the source method for installation, and installed is the latest version of 4.6.4, as follows:
wget Https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.zip
650) this.width=650; "title=" clip_image001 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image001 "src=" http://s3.51cto.com/wyfs02/M01/8B/F9/ Wkiom1hdo7axsbr7aabirum-pzs994.png "width=" 771 "height=" 173 "/>
Unzip phpmyadmin-4.6.4-all-languages.zip-d/data/dg/
Mv/data/dg/phpmyadmin-4.6.4-all-languages//data/dg/app_db/
chmod 755-r/data/dg/app_db/
650) this.width=650; "title=" clip_image002 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M02/8B/F9/wKiom1hdO7jibK_ Gaabiduv_nxc403.png "width=" 657 "height=" 94 "/>
Note: phpMyAdmin requires a LNMP environment, so it is necessary to install the relevant basic environment before running the phpMyAdmin.
phpMyAdmin decompression After the installation is complete, we will configure the Nginx, as follows:
650) this.width=650; "title=" clip_image003 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image003 "src=" http://s3.51cto.com/wyfs02/M00/8B/F5/ Wkiol1hdo7ma8db2aacscobccpg878.png "width=" 585 "height=" 625 "/>
Here I opened the Nginx directory indexing function, mainly considering that if there are multiple databases, we can be distinguished by the way directory names.
For example, our online database is as follows:
650) this.width=650; "title=" clip_image004 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M01/8B/F5/ Wkiol1hdo7rzyet3aaba45gvsgq091.png "width=" 354 "height=" 498 "/>
Now visit, as follows:
650) this.width=650; "title=" clip_image005 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image005 "src=" http://s3.51cto.com/wyfs02/M02/8B/F5/ Wkiol1hdo7ucqsoqaaatw2npakk807.png "width=" 495 "height=" 186 "/>
650) this.width=650; "title=" clip_image006 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M00/8B/F9/ Wkiom1hdo7zwfxzeaacocjnnzfc591.png "width=" 775 "height=" 572 "/>
Through, we can clearly see that the phpMyAdmin has been able to access the normal, but we need to enter the relevant user name and password.
Second, phpmyadmin password-free configuration
In the first chapter, we have installed the phpMyAdmin, this chapter we will configure the next phpmyadmin, password-free login access.
Here we take app_db this database as an example. To implement password-free login, we also need to create a read-only user ilanniread in the MySQL database for the app_db database.
Create the SQL statement as follows:
Mysql-hrm-bp183j9f186nd4933.mysql.rds.aliyuncs.com-uroot-p ' Ilanni '-e "Grant Select on app_db.* to ' ilanniread ' @ '% ' ID Entified by ' readonlyqwe ';
Once Ilanniread is created, we will now modify the phpMyAdmin configuration file config.default.php.
for config.default.php files, we only need to modify 106, 252, 259 rows, where line 106th is the connection address of the database, and rows No. 252 and 259 are the user name and password of the database, respectively. As follows:
650) this.width=650; "title=" clip_image007 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image007 "src=" http://s3.51cto.com/wyfs02/M00/8B/F5/ Wkiol1hdo72rc6xlaabo9opobyy456.png "width=" 584 "height=" 364 "/>
650) this.width=650; "title=" clip_image008 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image008 "src=" http://s3.51cto.com/wyfs02/M00/8B/F5/ Wkiol1hdo76rcqtcaaaycgurvv8539.png "width=" 453 "height=" 153 "/>
After the modification, we come back to see the actual effect, as follows:
650) this.width=650; "title=" clip_image009 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image009 "src=" http://s3.51cto.com/wyfs02/M01/8B/F6/wKioL1hdO7_ Iluzvaaet_enltyo401.png "width=" 992 "height=" 333 "/>
Through, we can obviously see that the current access to phpMyAdmin is not required to enter the database user name and password.
And by doing so, we can also let developers do not need to know the actual database address and database user name and password, relative security or improve a lot.
third, prohibit phpmyadmin export data
In the second section, we configured phpMyAdmin password-free access, and now configure how to prohibit the export of data that is queried through phpMyAdmin.
By default, phpMyAdmin is able to export the entire database, as follows:
650) this.width=650; "title=" clip_image010 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image010 "src=" http://s3.51cto.com/wyfs02/M01/8B/F6/ Wkiol1hdo8cq3-ovaadn6x6ke4o578.png "width=" 564 "height=" 564 "/>
In order to prevent developers from exporting the results of the query, we can do this, the phpMyAdmin root directory under the tbl_export.php or export.php file to rename it, as follows:
MV Export.php Export.php.bak
650) this.width=650; "title=" clip_image011 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; margin:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image011 "src=" http://s3.51cto.com/wyfs02/M02/8B/F6/ Wkiol1hdo8gas1ebaaaavu6lpme413.png "width=" 417 "height=" 104 "/>
Once the modifications are complete, we'll export the data to see the following:
650) this.width=650; "title=" clip_image012 "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" clip_image012 "src=" http://s3.51cto.com/wyfs02/M00/8B/F6/ Wkiol1hdo8kqqp52aaao5okqira236.png "width=" 471 "height=" 123 "/>
Through, we can easily see the current cannot export data, so that we prohibit phpmyadmin export data purposes.
Note: The export.php file is exported for the entire database, if you want to prohibit the export after the query, then we need to rename the tbl_export.php file.
PS: Security is relative, there is no absolute security, we can only do to prevent a gentleman against the villain.
Slime: Database management phpmyadmin password-free configuration