Basic operation of MySQL based on Linux operating system (III)
Command: SELECT DISTINCT concat (' User: ', user, ' @ ', host, '; ') as query from Mysql.user;
Note: (1) keyword DISTINCT is used to return only different values.
Syntax: SELECT DISTINCT column name from table name
(2) TheSQL concat function is used to concatenate two strings together to form a single string.
Compare the usage of both:
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8F/9C/wKioL1jm9erRLmgbAAAuu7vUGys548.png "style=" float : none; "title=" MySQL view user. PNG "alt=" Wkiol1jm9errlmgbaaauu7vugys548.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8F/9D/wKiom1jm9evzhhgfAAAnrkJB2hU792.png "style=" float : none; "title=" MySQL View user 2. PNG "alt=" Wkiom1jm9evzhhgfaaanrkjb2hu792.png "/>
(1) Command: Show grants for ' cacti ' @ ' 127.0.0.1 ';
As follows:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8F/9C/wKioL1jm9vaxTMTCAAAid4W8nk0949.png "title=" MySQL permissions. PNG "alt=" Wkiol1jm9vaxtmtcaaaid4w8nk0949.png "/>
(2) Command: SELECT * from Mysql.user where user= ' cacti ' \g;
As follows:
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8F/9D/wKiom1jm-EDzTOoiAAA6__E38Jw634.png "title=" 11. PNG "alt=" Wkiom1jm-edztooiaaa6__e38jw634.png "/>
Order: desc Mysql.user;
As follows:
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8F/9D/wKiom1jm-OWByaT3AAA0KtpfJv0536.png "title=" 11. PNG "alt=" Wkiom1jm-owbyat3aaa0ktpfjv0536.png "/>
Command: Delete from mysql.user where user= ' cacti ' and host= ' 127.0.0.1 ' \g;
As follows:
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8F/9C/wKioL1jm_M6REGfWAAAMOgclQJ0536.png "style=" float : none; "title=" 11.PNG "alt=" Wkiol1jm_m6regfwaaamogclqj0536.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8F/9D/wKiom1jm_M6CVsCNAAAnjndlGNs132.png "style=" float : none; "title=" 22.PNG "alt=" Wkiom1jm_m6cvscnaaanjndlgns132.png "/>
Note:mysql>flush privileges; (Refresh database)
Mysql>drop database TestDB; Delete a user's database
This article is from the "Hand of the Paladin Control" blog, please make sure to keep this source http://wutengfei.blog.51cto.com/10942117/1913714
Basic operation of MySQL based on Linux operating system (III)