content_image/816434.jpg
## 13.6.8 Restrictions on Condition Handling 

SIGNAL , RESIGNAL , and GET DIAGNOSTICS  are not permissible as prepared statements. For example, this statement is invalid: 

PREPARE stmt1 FROM ’SIGNAL SQLSTATE "02000"’; 

SQLSTATE  values in class ’04’  are not treated specially. They are handled the same as other exceptions. 

In standard SQL, the first condition relates to the SQLSTATE  value returned for the previous SQL statement. In MySQL, this is not guaranteed, so to get the main error, you cannot do this: 

## 13.7 Database Administration Statements 

## 13.7.1 Account Management Statements 

GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO; 

Instead, do this: 

GET DIAGNOSTICS @cno = NUMBER; GET DIAGNOSTICS CONDITION @cno @errno = MYSQL_ERRNO; 

MySQL account information is stored in the tables of the mysql  system schema. This database and the access control system are discussed extensively in Chapter 5, MySQL Server Administration , which you should consult for additional details. 

<img src='content_image/816434.jpg'>

## Important 

Some MySQL releases introduce changes to the grant tables to add new privileges or features. To make sure that you can take advantage of any new capabilities, update your grant tables to the current structure whenever you upgrade MySQL. See Section 2.11, “Upgrading MySQL” . 

When the read_only  system variable is enabled, account-management statements require the CONNECTION_ADMIN  privilege (or the deprecated SUPER  privilege), in addition to any other required privileges. This is because they modify tables in the mysql  system schema. 

Account management statements are atomic and crash safe. For more information, see Section 13.1.1, “Atomic Data Definition Statement Support” . 

## 13.7.1.1 ALTER USER Statement 

ALTER USER [IF EXISTS] user  [ auth_option ] [, user  [ auth_option ]] ... [REQUIRE {NONE | tls_option  [[AND] tls_option ] ...}] [WITH resource_option  [ resource_option ] ...] [ password_option  | lock_option ] ... [COMMENT ’ comment_string ’ | ATTRIBUTE ’ json_object ’] ALTER USER [IF EXISTS] USER() user_func_auth_option ALTER USER [IF EXISTS] user  DEFAULT ROLE {NONE | ALL | role  [, role  ] ...} user : (see Section 6.2.4, “Specifying Account Names” ) 

