MySQL学习笔记——显示数据库信息
show privileges
顯示可用的系統權限清單?! ?/p> View Code mysql> show privileges;
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Privilege | Context | Comment |
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Alter | Tables | To alter the table |
| Alter routine | Functions,Procedures | To alter or drop stored functions/procedures |
| Create | Databases,Tables,Indexes | To create new databases and tables |
| Create routine | Databases | To use CREATE FUNCTION/PROCEDURE |
| Create temporary tables | Databases | To use CREATE TEMPORARY TABLE |
| Create view | Tables | To create new views |
| Create user | Server Admin | To create new users |
| Delete | Tables | To delete existing rows |
| Drop | Databases,Tables | To drop databases, tables, and views |
| Event | Server Admin | To create, alter, drop and execute events |
| Execute | Functions,Procedures | To execute stored routines |
| File | File access on server | To read and write files on the server |
| Grant option | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess |
| Index | Tables | To create or drop indexes |
| Insert | Tables | To insert data into tables |
| Lock tables | Databases | To use LOCK TABLES (together with SELECT privilege) |
| Process | Server Admin | To view the plain text of currently executing queries |
| Proxy | Server Admin | To make proxy user possible |
| References | Databases,Tables | To have references on tables |
| Reload | Server Admin | To reload or refresh tables, logs and privileges |
| Replication client | Server Admin | To ask where the slave or master servers are |
| Replication slave | Server Admin | To read binary log events from the master |
| Select | Tables | To retrieve rows from table |
| Show databases | Server Admin | To see all databases with SHOW DATABASES |
| Show view | Tables | To see views with SHOW CREATE VIEW |
| Shutdown | Server Admin | To shut down the server |
| Super | Server Admin | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. |
| Trigger | Tables | To use triggers |
| Create tablespace | Server Admin | To create/alter/drop tablespaces |
| Update | Tables | To update existing rows |
| Usage | Server Admin | No privileges - allow connect only |
+-------------------------+---------------------------------------+-------------------------------------------------------+
select user,host from mysql.user;
顯示服務器上用戶賬號的一個列表。
?
SET PASSWORD [for 'user'@'host']=PASSWORD('password')
修改用戶賬戶密碼。
?
SHOW GRANTS [FOR 'user'[@'host']]
為給定用戶列出GRANT語句。如果沒有指定FOR語句,默認為當前用戶。
?SELECT DATABASE();
顯示當前數據庫。
SELECT CURRENT_USER();
顯示當前mysql服務器連接的用戶名和主機的組合。
SELECT USER();
顯示當前會話連接的用戶名和主機的組合。
SHOW CREATE TABLE
SHOW CREATE TABLE tbl_nameShows the?CREATE TABLE?statement that creates the given table.
?
SHOW CREATE {DATABASE | SCHEMA} db_nameShows the?CREATE DATABASE?statement that creates the given database.?SHOW CREATE SCHEMA?is a synonym forSHOW CREATE DATABASE.
?
待續。。。
轉載于:https://www.cnblogs.com/freewater/archive/2012/07/28/2289318.html
總結
以上是生活随笔為你收集整理的MySQL学习笔记——显示数据库信息的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 关于c#中全局类变量的建立
- 下一篇: Windows API 逐个逐个学Mes