
MySQL 5.7 新增默认
账号 mysql.session和mysql.syshttps://www.jianshu.com/p/427cac0d8763Privileges Supported by MySQLhttps://dev.mysql.com/doc/refman/5.7/en/grant.htmlMySQL 5.7 Reference Manual/Reserved Accountshttps://dev.mysql.com/doc/refman/5.7/en/reserved-users.htmlWhat are mysql.session@localhost and mysql.sys@localhost user accounts good for?https://stackoverflow.com/questions/46149220/what-are-mysql-sessionlocalhost-and-mysql-syslocalhost-user-accounts-good-forOne part of the MySQL installation process is data directory initialization (see Section 2.10.1, “Initializing the Data Directory” ). During data directory initialization, MySQL creates user accounts that should be considered reserved:'root'@'localhost : Used for administrative purposes. This account has all privileges and can perform any operation. Strictly speaking, this account name is not reserved, in the sense that some installations rename the root account to something else to avoid exposing a highly privileged account with a well-known name.'mysql.sys'@'localhost' : Used as the DEFINER for sys schema objects. Use of the mysql.sys account avoids problems that occur if a DBA renames or removes the root account. This account is locked so that it cannot be used for client connections.'mysql.session'@'localhost' : Used internally by plugins to access the server. This account is locked so that it cannot be used for client connections.用于sys schema中对象的定义。使用mysql.sys用户可避免DBA重命名或者删除root用户时发生的问题。该用户已被锁定,客户端无法连接。插件内部使用来访问服务器。该用户已被锁定,客户端无法连接。root账号,其用于管理。该用户拥有所有权限,可执行任何 *** 作。 root是MySQL的特权账号,这个众所周知,也带来安全隐患,建议将root账号禁用或者删除,新建一个特权账号用于管理。alter
table
[tablename]
drop
constraint
[标识]
ALTER
TABLE
[tableName]
ADD
CONSTRAINT
[标识]
DEFAULT
(25)
FOR
[columnName]
如果原字段没有默认值,下面一句就不用写了:
alter
table
[tablename]
drop
constraint
[标识]
即先给此字段添加一个默认值
要已经有了默认值就写上面的Ok
先在父表中将对应的记录插进去,再插子表,因为子表中外键约束的一列数据必须在父表中存在。像
学生表和学生成绩表,在学生成绩表中要插入一条记录,如果此记录中学号字段的值在学生表中找不到,即不存在这个学生,自然学生成绩表中就插不进去。
评论列表(0条)