• 主页

  • 投资

  • IT

    🔥
  • 设计

  • 销售

  • 共99篇

    mysql数据库

关闭

返回栏目

关闭

返回mysql数据库栏目

25 - 初始库2/4 - mysql - 详解

作者:

贺及楼

成为作者

更新日期:2024-10-09 10:25:45

初始库2_4 - mysql - 详解

mysql作用介绍:

mysql:这个是mysql的核心数据库,类似于sql

server中的master表,主要负责存储数据库的用户、权限设置、关键字等mysql自己需要使用的控制和管理信息。
不可以删除
如果对mysql不是很了解,也不要轻易修改这个数据库里面的表信息。

列名 数据类型 是否为空 key 默认值 extra额外的
Host char(255) NO PRI `` ``
User char(32) NO PRI `` ``
Select_priv enum('N'\'Y') NO `` N ``
Insert_priv enum('N'\'Y') NO `` N ``
Update_priv enum('N'\'Y') NO `` N ``
Delete_priv enum('N'\'Y') NO `` N ``
Create_priv enum('N'\'Y') NO `` N ``
Drop_priv enum('N'\'Y') NO `` N ``
Reload_priv enum('N'\'Y') NO `` N ``
Shutdown_priv enum('N'\'Y') NO `` N ``
Process_priv enum('N'\'Y') NO `` N ``
File_priv enum('N'\'Y') NO `` N ``
Grant_priv enum('N'\'Y') NO `` N ``
References_priv enum('N'\'Y') NO `` N ``
Index_priv enum('N'\'Y') NO `` N ``
Alter_priv enum('N'\'Y') NO `` N ``
Show_db_priv enum('N'\'Y') NO `` N ``
Super_priv enum('N'\'Y') NO `` N ``
Create_tmp_table_priv enum('N'\'Y') NO `` N ``
Lock_tables_priv enum('N'\'Y') NO `` N ``
Execute_priv enum('N'\'Y') NO `` N ``
Repl_slave_priv enum('N'\'Y') NO `` N ``
Repl_client_priv enum('N'\'Y') NO `` N ``
Create_view_priv enum('N'\'Y') NO `` N ``
Show_view_priv enum('N'\'Y') NO `` N ``
Create_routine_priv enum('N'\'Y') NO `` N ``
Alter_routine_priv enum('N'\'Y') NO `` N ``
Create_user_priv enum('N'\'Y') NO `` N ``
Event_priv enum('N'\'Y') NO `` N ``
Trigger_priv enum('N'\'Y') NO `` N ``
Create_tablespace_priv enum('N'\'Y') NO `` N ``
ssl_type enum(''\'ANY'\'X509'\'SPECIFIED') NO `` `` ``
ssl_cipher blob NO `` NULL ‘’
x509_issuer blob NO `` NULL ‘’
x509_subject blob NO `` NULL ‘’
max_questions int unsigned NO `` 0 ``
max_updates int unsigned NO `` 0 ``
max_connections int unsigned NO `` 0 ``
max_user_connections int unsigned NO `` 0 ``
plugin char(64) NO `` caching_sha2_password ``
authentication_string text YES `` NULL ‘’
password_expired enum('N'\'Y') NO `` N ``
password_last_changed timestamp YES `` NULL ‘’
password_lifetime smallint unsigned YES `` NULL ‘’
account_locked enum('N'\'Y') NO `` N ``
Create_role_priv enum('N'\'Y') NO `` N ``
Drop_role_priv enum('N'\'Y') NO `` N ``
Password_reuse_history smallint unsigned YES `` NULL ‘’
Password_reuse_time smallint unsigned YES `` NULL ‘’
Password_require_current enum('N'\'Y') YES `` NULL ‘’
User_attributes json YES `` NULL ‘’

用户、权限设置、关键字

  1. mysql> use mysql;
  2. mysql> select host,user,plugin from user;
  3. mysql> select host,user,plugin,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv from user;
  4. +-----------+---------------+
  5. | host | user |
  6. +-----------+---------------+
  7. | % | root |
  8. | localhost | mysql.session |
  9. | localhost | mysql.sys |
  10. | localhost | root |
  11. +-----------+---------------+
  12. mysql> delete from user where host="%";
  13. mysql> flush priviledges; 刷新权限

%随便看
创建用户、授权、设置与更改用户密码、撤销用户权限、删除用户

  1. 最大权限
  2. GRANT ALL PRIVILEGES ON *.* TO "myuser"@"%"IDENTIFIED BY "mypassword" WITH GRANT OPTION;